#include<iostream>
#include<string.h>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main(){
    int i,j,n,k[100],count=0;
    char c1[100],c2[100],c3[100],c4[100],c5[100],c6[100];
    for(j=0;j<100;j++){
    cin>>n;
    for(i=0;i<n;i++){
        cin>>c1>>c2>>c3>>c4>>c5>>c6;
        k[i]=c1[i]>>c2[i]>>c3[i]>>c4[i]>>c5[i]>>c6[i];
    }
        if(k[i]==k[i]){
            count++;
        }
        cout<<count<<endl;
        count=0;
        if(c1==0){
            break;
        }
}
    
    return 0;
}