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