import scala.io.Source

object Main extends App {
  val src = Source.stdin.getLines.toList.flatMap(_.split(" ").toList)
  val target = src(0)

  def removeOthers(src: List[String]): List[String] = {
    for {
      word <- src.tail
      if (word.contains(target))
    } yield word
  }

  println(removeOthers(src).length)
}