import strutils, sequtils


proc isAmaou(xs: seq[string]): bool =
  const
    a = @[
      "akai",
      "marui",
      "okii",
      "umai",
    ]
  a.allIt(it in xs)


let
  n = parseInt readLine stdin
  xs = n.newSeqWith stdin.readLine.split.toSeq

echo xs.countIt it.isAmaou