check={"akai", "marui", "okii", "umai"} N=int(input()) ans=0 for i in range(N): inp = set(input().split()) if inp==check: ans+=1 print(ans)