n = gets.chomp.to_i
s = gets.chomp
cnt = 0
for i in 0..999
    c = [i/100,(i/10)%10,i%10]
    f = 0
    for j in 0..n-1
        f+=1 if s[j].to_i == c[f]
        if f==3
            cnt+=1
            break
        end
    end
end
puts cnt