n = gets.to_i
s = gets.chomp
pins = {}
hash = {}
count = Array.new(10, 0)
for i in 0...n do
  x = s[i].to_i
  count[x] += 1
end
for i in 0...(n - 2) do
  xi = s[i].to_i
  count[xi] -= 1
  count2 = count.dup
  for j in (i + 1)...(n - 1) do
    xj = s[j].to_i
    count2[xj] -= 1
    if !hash.include?([xi, xj])
      for d in 0..9 do
        if count2[d] > 0
          pins[xi.to_s + xj.to_s + d.to_s] = true
        end
      end
      hash[[xi, xj]] = true
    end
  end
end
puts pins.size
