n=int(input()) s=sorted(['akai','marui','okii','umai']) c=0 for i in range(n): t=sorted(input().split()) if s==t: c+=1 print(c)