N = gets.to_i
S = gets.chomp.chars.map &:to_i
P = Array.new(1000,false)
count = 0

0.upto(N-3) do |i|
  (i+1).upto(N-2) do |j|
    (j+1).upto(N-1) do |k|
      key = S[i] * 100 + S[j] * 10 + S[k]
      unless P[key]
        count += 1
        P[key] = true
      end
    end
  end
end

p count
