N = gets.to_i
S = gets.chomp

count = 0
for i in 0..9
  a = S.index(i.to_s)
  if a != nil
    for j in 0..9
      b = S.index(j.to_s, a+1)
      if b != nil
        for k in 0..9
          c = S.index(k.to_s, b+1)
          if c != nil
            count += 1
          end
        end
      end
    end
  end
end

puts count