n = gets.to_i
s = gets.chomp

cnt = 0
('0'..'9').each do |c|
  i = s.index c
  next unless i
  ('0'..'9').each do |d|
    j = s.index d, i+1
    next unless j
    ('0'..'9').each do |e|
      k = s.index e, j+1
      next unless k
      #STDERR.puts c+d+e
      cnt += 1
    end
  end
end

p cnt