I need help understanding why this program outputs "Count = 3" if the input file is:

-3xy' - ay" - bcos(t) = sin(t)
,
4y - 3y' = - y'

What I intended for my counter to output was the number of characters there are in my input file. Any help is appreciated.

Code:
main()
{    int count = 0;
    char z[1000];
    FILE *fin, *fout;
    fin = fopen("cp1_ODEin.txt", "r");
        if((fin = fopen("cp1_ODEin.txt", "r")) == NULL)
            printf("Failed to open cp1_ODEin.txt");
    fout = fopen("cp1_ODEout.txt", "w");
        if((fout = fopen("cp1_ODEout.txt", "w")) == NULL)
            printf("Failed to open cp1_ODEout.txt");
     
    while(fgets(z, 1000, fin) != NULL){
        fputs(z, stdout);
        count = count + 1;
    }
    printf("\nCount = %d", count);
    fclose(fin);
    fclose(fout);
}