n = gets.to_i
s = gets.chomp
cnt = 0
1000.times do |t|
  k = t.to_s.rjust(3,"0",)
  j = 0
  n.times do |i|
    if s[i] == k[j]
      j += 1
    end
    break if j == 3
  end
  cnt += 1 if j == 3
end

puts cnt