n = gets.to_i
s = gets.chomp

pos = []

(0..9).each do |i|
  (0..9).each do |j|
    (0..9).each do |k|
      pos << i.to_s+j.to_s+k.to_s
    end
  end
end

ans = []
pos.each do |p|
  a, b, c = p.chars
  if /.*#{a}.*#{b}.*#{c}/.match(s)
    ans << [a, b, c]
  end
end
puts ans.uniq.count
