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

a = Set.new()

1.upto(n-2).each do |i|
  # p [left, s[i], right]
  s.slice(0,i).uniq.each do |l|
    s.slice(i+1, n).uniq.each do |r|
      a.add l + s[i] + r
    end
  end

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

puts a.size