_,*s=[set(i.split())=={'umai','marui','okii','akai'}for i in open(0).readlines()] print(sum(s))