require 'set'

def main
  n = gets.to_i
  s = gets.chomp

  ansset = Set.new
  (0..9).each do |a|
    s_a = a.to_s
    idx_a = s.index(s_a)
    next if idx_a.nil?
    (0..9).each do |b|
      s_b = b.to_s
      idx_b = s.index(s_b,idx_a+1)
      next if idx_b.nil?
      (0..9).each do |c|
        s_c = c.to_s
        idx_c = s.index(s_c,idx_b+1)
        ansset.add(s_a+s_b+s_c) unless idx_c.nil?
      end
    end
  end
  puts ansset.size
end

main

