nketa = STDIN.gets.chomp.to_i
lucky = STDIN.gets.chomp

array = lucky.split('')
s = array.size - 1
result = []
checker = []
count = 0
stock = []
stock2 = []

array.each_with_index do |a, i|
  j = i + 1
  for b in j..s do
    unless stock2.include?([a, array[b]])
      stock2 << [a, array[b]]
      for c in (j + 1)..s do
        unless stock.include?(array[c])
          result << [a, array[b], array[c]]
          stock << array[c]
          count += 1
        end
      end
      stock = []
    end
    j = j + 1
  end
end
puts count