n = gets.to_i
s = gets.chomp

hs = Hash.new

n.times do |i|
  hs[s[i]] ||= []
  hs[s[i]] << i
end

res = 0
10.times do |i|
  if hs[i.to_s].nil?
    next
  end
  ix = hs[i.to_s][0]
  10.times do |j|
    if hs[j.to_s].nil?
      next
    end
    jx = hs[j.to_s].bsearch {|x| x > ix }
    if jx.nil?
      next
    end
    10.times do |k|
      if hs[k.to_s].nil?
        next
      end
      kx = hs[k.to_s].bsearch {|x| x > jx }
      if !kx.nil?
        res += 1
      end
    end
  end
end
puts res