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

ans = 0
c = ('0'..'9')
c.each do |i|
  pos_i = s.index(i)
  c.each do |j|
    pos_i ? (pos_j = s.index(j, pos_i+1)) : next
    c.each do |k|
      ans += 1 if pos_j && s.index(k, pos_j+1)
    end
  end
end

puts ans