s = {'akai', 'marui', 'okii', 'umai'} N = int(input()) ans = 0 for _ in range(N): ss = input().split() if set(ss) == s: ans += 1 print(ans)