require 'set'
n = gets.chomp.to_i
s = gets.chomp.split(//)

a = Set.new()

left = [Set.new([s.first])]
right = Array.new(n-2)
right[-1] = Set.new([s.last])

1.upto(n-3).each do |i|
  left[i] = left[i-1].dup
  left[i].add s[i]
  # break if left.size == 10
end

(n-3).downto(1).each do |i|
  # p right
  right[i-1] = right[i].dup
  right[i-1].add s[i+1]
  # break if right.size == 10
end

if false
  p left
  p right
  p left.size
  p right.size
  exit
end

1.upto(n-2).each do |i|
  left[i-1].each do |l|
    right[i-1].each do |r|
      a.add l + s[i] + r
    end
  end

  break if a.size == 1000
  # break if i == 1000
end

puts a.size
