n = gets.to_i
s = gets.chomp
count = 0
for a in 0..9 do
  ai = s.index(a.to_s)
  if !ai.nil?
    for b in 0..9 do
      bi = s.index(b.to_s, ai + 1)
      if !bi.nil?
        for c in 0..9 do
          ci = s.index(c.to_s, bi + 1)
          if !ci.nil?
            count += 1
          end
        end
      end
    end
  end
end
puts count
