n = gets.to_i
s = gets.chomp.chars
h = Hash.new(0)
n.times do |i|
  t = s[i].dup
  i.next.upto(n - 1) do |j|
    u = t + s[j]
    j.next.upto(n - 1) do |k|
      v = u + s[k]
      h[v] += 1
    end
  end
end
puts h.size