N=gets.to_i
S=gets.chomp

ret = 0

('0'..'9').each do|i|
  ('0'..'9').each do|j|
    ('0'..'9').each do|k|
      a = S.index(i,0)
      next unless a
      b = S.index(j,a+1)
      next unless b
      c = S.index(k,b+1)
      if c
        ret += 1
        # p [[i,j,k],[a,b,c]]
      end
    end
  end
end

puts ret
