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

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

puts ans