amaou = ['akai', 'marui', 'okii', 'umai'] N = int(input()) ans = 0 for _ in range(N): S = sorted(input().split()) if S == amaou: ans += 1 print(ans)