N=int(input()) ans=0 for _ in range(N): S=list(input().split()) if "akai" in S and "marui" in S and "okii" in S and "umai" in S: ans+=1 print(ans)