lines = $stdin.read
array = lines.split("\n")
N = array[0].to_i
S = array[1].split("")
ans = 0

(0..999).each do |n|
  nnn = sprintf "%03d\n", n
  idx1 = S.index(nnn[0])
  idx2 = S[idx1+1, S.length].index(nnn[1]) unless idx1.nil?
  idx3 = S[idx1+idx2+2, S.length].index(nnn[2]) unless idx2.nil?

  if not idx1.nil? and not idx2.nil? and not idx3.nil?
    #p nnn
    ans += 1
  end
end

puts ans