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