n = int(input()) ls = {"akai", "marui", "okii", "umai"} c = 0 for i in range(n): lz = set(input().split()) if ls == lz: c += 1 print(c)