n=gets.to_i
s=gets.chomp
cnt=0
["0","1","2","3","4","5","6","7","8","9"].repeated_permutation(3) do |a,b,c|
  if s.index(a)
    if s.index(b,s.index(a)+1)
      if s.index(c,s.index(b,s.index(a)+1)+1)
        cnt+=1
      end
    end
  end
end
puts cnt