n = gets.to_i
s = gets.chomp
h0 = {}
h1 = {}
h2 = {}
n.times do |i|
  h1.keys.each do |k2|
    if h2.key?(k2 + s[i]) == false
      h2[k2 + s[i]] = 1
    end
  end
  h0.keys.each do |k1|
    if h1.key?(k1 + s[i]) == false
      h1[k1 + s[i]] = 1
    end
  end
  if h0.key?(s[i]) == false
    h0[s[i]] = 1
  end
end
puts h2.keys.size