S = ['akai','marui','okii','umai'] S.sort() N = int(input()) ans = 0 for i in range(N): T = list(map(str,input().split())) T.sort() if S == T: ans += 1 print(ans)