## main

n = gets.strip.to_i

name = gets.strip
nmlen = name.length
nm0 = name[0]
nm1 = name[1]

count = 0

n.times do
  old = gets.strip
  olen = old.length
  found = false

  for i in (0...olen)
    next if old[i] != nm0

    for j in ((i + 1)...olen)
      next if old[j] != nm1

      d = j - i
      found = true

      for k in (2...nmlen)
        if old[i + d * k] != name[k]
          found = false
          break
        end
      end

      if found
        count += 1
        break
      end
    end

    break if found
  end
end

puts count