n = gets.chomp.to_i
s = gets.chomp


result ={}
count =0
10.times do |i|
  index_i = s.index(i.to_s)
  next if index_i.nil?
  tmp_j = s[(index_i+1)..-1]
  10.times do |j|
    index_j = tmp_j.index(j.to_s)
    next if index_j.nil?
    tmp_k = tmp_j[(index_j+1)..-1]
    10.times do |k|
      unless tmp_k.index(k.to_s).nil?
        count += 1
      end
    end
  end
end


puts count