n = gets.to_i
s = gets.chomp.split(//).map &:to_i

cl = Array.new(n+1, 0)
cr = Array.new(n+1, 0)
cnt = Array.new(1000, 0)

n.times do |i|
  j = n - i
  cl[i+1] = cl[i] | 2 ** s[i]
  cr[j-1] = cr[j] | 2 ** s[j-1]
end

n.times do |i|
  l = cl[i]
  r = cr[i+1]
  m = s[i]
  10.times do |j|
    10.times do |k|
      next if l[j] == 0 || r[k] == 0
      ix = j * 100 + m * 10 + k
      cnt[ix] = 1
    end
  end
end

ans = cnt.count(1)
puts ans