# frozen_string_literal: true

n = gets.to_i
s = gets.chomp.chars.map(&:to_i)
count = 0
0.upto(9) do |i|
  0.upto(9) do |j|
    0.upto(9) do |k|
      flag = false
      a = [i, j, k]
      p = 0
      0.upto(n - 1) do |t|
        if s[t] == a[p]
          p += 1
          if p == 3
            count += 1
            flag = true
          end
        end
        break if flag
      end
    end
  end
end
puts count
