N = gets.to_i
S = gets.chomp.split('').map(&:to_i)
count = 0
0.upto(999) do |i|
  p = i.to_s.split('').map(&:to_i)
  (3 - p.length).times{p.unshift(0)} unless p.length == 3
  first, second, third = -1, -1, -1
  catch :ok do
    0.upto(N - 3) do |f|
      if S[f].to_i == p[0]
        (f + 1).upto(N - 2) do |s|
          if S[s].to_i == p[1]
            (s + 1).upto(N - 1) do |t|
              if S[t].to_i == p[2]
                count += 1
                throw :ok
              end
            end
          end
        end
      end
    end
  end
end
puts count