# frozen_string_literal: true

n = gets.to_i
s = gets.chomp.chars.map(&:to_i)
count = 0
0.upto(999) do |x|
  a = x % 10
  p = 0
  0.upto(n - 1) do |t|
    if s[t] == a
      x /= 10
      a = x % 10
      p += 1
      if p == 3
        count += 1
        flag = true
      end
    end
    break if flag
  end
end
puts count
