#!/usr/bin/env ruby
n = gets.chomp.to_i
s = gets.chomp

ans = 0
0.upto(9) do |i|
  first_i = s.chars.find_index(i.to_s)
  next if first_i.nil?
  0.upto(9) do |j|
    new_s = s[(first_i+1)..-1]
    first_j = new_s.chars.find_index(j.to_s)
    next if first_j.nil?
    0.upto(9) do |k|
      new_new_s = new_s[(first_j+1)..-1]
      first_k = new_new_s.chars.find_index(k.to_s)
      next if first_k.nil?
      ans += 1
    end
  end
end

puts ans
