n = gets.to_i
s = gets.chomp.chars
cnt = 0
vs = []
("0".."9").each do|i|
  ("0".."9").each do|j|
    ("0".."9").each do|k|
      vs << i + j + k
    end
  end
end
vs.each do |v|
  current = 0
  flag = false
  (0..2).each do |i|
    flag = false
    loop do
      break if current > n-1 || v[i] == s[current]
      current += 1
    end
    if v[i] == s[current]
      flag = true
      current += 1
    end
    break if flag == false
  end

  if flag == true
    cnt += 1
  end
end

puts cnt