#require 'pp'

ans = []
(0..9).each do |i|
  (0..9).each do |j|
    (0..9).each do |k|
      ans << [i, j, k]
    end
  end
end

n = gets.chomp!.to_i
s = gets.chomp!.chars.map(&:to_i)

count = 0
ans.each do |x|
  index = 0
  target = x[0]
  target_index = 0
  while index < s.length
    if target == s[index]
      if target_index == 2
        count += 1
        break
      end
      target_index += 1
      target = x[target_index]
    end

    index += 1
  end
end

puts count
