import sys; input = sys.stdin.readline N = int(input()) amaou = {'akai', 'marui', 'okii', 'umai'} count = 0 for _ in range(N): S = set(input().split()) if S == amaou: count += 1 print(count)