N = gets.to_i
S = gets.chomp
passList = []


for i in 0..N-3
  for j in i+1..N-2
    for k in j+1..N-1
      pass = S.slice(i)+S.slice(j)+S.slice(k)
      if !passList.include?(pass)
        passList.push(pass)
      end
    end
  end
end

puts passList.size