local n=io.read("*n","*l")
local s=tostring(io.read())

local counter=0
for i=0,999 do
    k=string.format("%03d",i)
    local a,b=0,0
    for j=1,n do
        if s:sub(j,j)==k:sub(1,1) then
            a=j
            break
        end
    end
    if a>0 then
        for j=a+1,n do
            if s:sub(j,j)==k:sub(2,2) then
                b=j
                break
            end
        end
        if b>a then
            for j=b+1,n do
                if s:sub(j,j)==k:sub(3,3) then
                    counter=counter+1
                    break
                end
            end
        end
    end
end
print(counter)