N = gets.chomp.to_i
S = gets.chomp.chars

patterns = []

(0..N-3).each do |a|
  (a+1..N-2).each do |b|
    (b+1..N-1).each do |c|
      patterns << S[a] + S[b] + S[c]
    end
  end
end

puts patterns.uniq.count