n = gets.to_i
s = gets.chomp
cnt = 0
("000".."999").each do |k|
  i = 0
  j = 0
  while j < 3 && i < n
    if s[i] == k[j]
      j += 1
    end
    i += 1
  end
  if j == 3
    cnt += 1
  end
end

puts cnt