input: from typing import List
  
  def count_pairs(numbers: List[int], x: int) -> int:
      """ Count the number of pairs in the list that sum up to a given value x.
      This function uses a two-pointer technique to efficiently count pairs.
      >>> count_pairs([1, 2, 3, 4, 5, 6], 10)
      1
      >>> count_pairs([1, 9, 2, 8, 3, 7, 4, 6], 10)
      4
      """
output:     count = 0
      numbers.sort()
      left, right = 0, len(numbers) - 1
      
      while left < right:
          current_sum = numbers[left] + numbers[right]
          if current_sum == x:
              count += 1
              left += 1
              right -= 1
          elif current_sum < x:
              left += 1
          else:
              right -= 1
      
      return count