a=int(input()) print(sum((set(input().split())==set("akai marui okii umai".split()))for i in range(a)))