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

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

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