# sが部分列tを含むか
def include?(s,t)
  i = 0
  s.chars.each do |c|
    i += 1 if t[i] == c
  end
  i == t.size
end

n = gets.to_i
s = gets.chomp
ans = 0
("000".."999").each do |t|
  if include?(s,t)
    ans += 1
  end
end
puts ans
