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