N = gets.chomp.to_i
S = gets.chomp
a = Array.new(3)
answer = 0
for i in 0...1000 do
    a[0] = i/100
    a[1] = (i/10)%10
    a[2] = i%10
    j = 0
    k = 0
    while j < N && k < 3
        if a[k] == S[j]
            k += 1
            if k == 3
              answer += 1  
            end
        end
        j += 1
    end
end
puts answer