# https://atcoder.jp/contests/sumitrust2019/tasks/sumitb2019_d



N = gets.to_i
S = gets.chomp

ans = 0
(0..999).each do |x|
  code = sprintf("%03d", x)
  ans += 1 if S =~ /\d*[#{code[0]}]\d*[#{code[1]}]\d*[#{code[2]}]\d*/
end
puts ans
