n=gets.to_i
s=gets.chomp.to_s


#p s
count=0
for i in 0..9
    i=i.to_s
    v=s.index(i)
    if v==nil
        next
    end
    for j in 0..9
       j=j.to_s
        vv=s.index(j,v+1)
      if vv==nil
              next
      
    end
            for k in 0..9
               k=k.to_s
                vvv=s.index(k,vv+1)
                if vvv==nil
                        next
                
                end
                #p [i,j,k]
                count+=1
               
            end
        
    end


        
end

p count