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

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

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