n = gets.to_i
s = gets.chomp
cnt = 0
(?0..?9).each do |a|
  i = s.index a, 0
  next unless i
  (?0..?9).each do |b|
    j = s.index b, i+1
    next unless j
    (?0..?9).each do |c|
      k = s.index c, j+1
      cnt += 1 if k
    end
  end
end
p cnt