N = gets.to_i
S = gets.chomp
count = 0
0.upto(999) do |i|
  if i < 10
    p = "00" + i.to_s
  elsif i < 100
    p = "0" + i.to_s
  else
    p = i.to_s
  end
  f = S.index(p[0])
  if f
    s = S.index(p[1], (f + 1))
    if s
      t = S.index(p[2], (s + 1))
      if t
        count += 1
        next
      end
    end
  end
end
puts count