n=gets.to_i
s=gets.chomp.split("").map(&:to_i)


#p s
result=[]
for i in 0..s.length-1
    for j in i+1..s.length-1
        for k in j+1..s.length-1
            v=[s[i],s[j],s[k]]
            result<<v
        end
    end
end
    
result.uniq!
p result.length