n=int(input()) S={"akai","marui","okii","umai"} ans=0 for _ in range(n): L=set(list(map(str,input().split()))) if L==S: ans+=1 print(ans)