n = gets.chomp.to_i
s = gets.chomp

keys = []
initial = []
for i in 0..(n - 3) do
  next if initial.include?(s[i])
  initial << s[i]
  for j in (i + 1)..(n - 2) do
    for k in (j + 1)..(n - 1) do
      keys << "#{s[i]}#{s[j]}#{s[k]}"
    end
  end
end
puts keys.uniq.length