n = int(input()) amaou = {"akai", "marui", "okii", "umai"} ans = 0 for _ in range(n): s = set(input().split()) ans += s == amaou print(ans)