n = gets.chomp.to_i
s = gets.chomp.split(//).map(&:to_i)

def find_index_recursive(arr, char, prev_index)
  index = arr.find_index(char)
  return unless index
  if index < prev_index
    arr[index] = -1
    find_index_recursive(arr, char, prev_index)
  else
    index
  end
end

def main(n, s)
  sum = 0
  (0..9).each do |i|
    (0..9).each do |j|
      (0..9).each do |k|
        arr = s.clone

        index1 = arr.find_index(i)
        next unless index1
        arr[index1] = -1

        index2 = find_index_recursive(arr, j, index1)
        if !index2 || index2 < index1
          next
        end
        arr[index2] = -1

        index3 = find_index_recursive(arr, k, index2)
        if !index3 || index3 < index2
          next
        end
        arr[index3] = -1

        sum += 1
      end
    end
  end
  sum
end

puts main(n, s)


# require 'minitest/autorun'

# class FooTest < Minitest::Test
#   def test_case1
#     assert_equal(3, main(4, '0224'.split(//).map(&:to_i)))
#   end

#   def test_case2
#     assert_equal(17, main(6, '123123'.split(//).map(&:to_i)))
#   end

#   def test_case3
#     assert_equal(329, main(6, '3141592653589793238'.split(//).map(&:to_i)))
#   end
# end
