I=input print(sum(set(I().split())==set("akai,marui,okii,umai".split(","))for n in range(int(I()))))