# frozen_string_literal: true

_n = gets.to_i
s = gets.chomp
count = 0
('0'..'9').each do |i|
  t = s.index(i)
  next if t.nil?

  ('0'..'9').each do |j|
    u = s.index(j, t + 1)
    next if u.nil?

    ('0'..'9').each do |k|
      v = s.index(k, u + 1)
      next if v.nil?

      count += 1
    end
  end
end
puts count
