N=int(input()) ans=0 B=['akai','marui','okii','umai'] B=sorted(B) for i in range(N): A=list(input().split()) A=sorted(A) if A==B: ans+=1 print(ans)