n = gets.to_i
name = gets.chomp
boards = []
n.times { boards << gets.chomp }

ans = 0
boards.each do |board|
  w = 0
  # p board
  catch :a do
    loop do
      board.chars.each_with_index do |c, c_i|
        break if c_i + name.size + w * (name.size - 1) > board.size

        match = true
        name.chars.each_with_index do |ch, ch_i|
          nxt = board[c_i + (w+1) * ch_i]
          # puts [c_i, ch_i, c_i + (w+1) * ch_i].to_s
          unless nxt == ch
            match = false
            break
          end
        end

        if match
          ans += 1
          # puts "found ans"
          throw :a
        end
      end
      w += 1
      break if name.size + w * (name.size - 1) >= board.size
    end
  end
end

puts ans