# frozen_string_literal: true

n = gets.to_i
s = gets.chomp
count = 0
as = ('0'..'9').to_a.repeated_permutation(3).to_a
as.each do |a|
  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
puts count
