n=int(input()) S = [input().split() for i in range(n)] cnt=0 for i in range(n): a=0 b=0 c=0 d=0 for j in range(4): if(S[i][j]=="akai"): a=1 if(S[i][j]=="marui"): b=1 if(S[i][j]=="okii"): c=1 if(S[i][j]=="umai"): d=1 if a and b and c and d: cnt+=1 print(cnt)