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