N = gets.chomp.to_i
S = gets.chomp.split('')

ans = 0
(0..9).to_a.map(&:to_s).repeated_permutation(3) do |a|
  flags = [false, false, false]
  S.each do |s|
    if !flags[0]
      if a[0] == s
        flags[0] = true
        next
      end
    elsif !flags[1]
      if a[1] == s
        flags[1] = true
        next
      end
    elsif !flags[2]
      if a[2] == s
        ans += 1
        break
      end
    end
  end
end
p ans
