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