N = int(input()) ans = 0 X = {"akai", "marui", "okii", "umai"} for _ in range(N): S = set(input().split()) if X == S: ans += 1 print(ans)