input: Write a function to count the number of pairs in a list of numbers that sum up to a given value x. If the list is empty return 0.
  
  def count_pairs(numbers, x):
      count = 0
      i, j = 0, len(numbers) - 1
      while i < j: 
          sum = numbers[i] + numbers[j]
          if sum == x: 
              count += 1
              i += 1
          elif sum < x: 
              i += 1 
          else: 
              j -= 1
      return count
  
  assert count_pairs([1, 2, 3, 4, 5], 7) == 2
  assert count_pairs([1, 4, 4, 5, 6, 8, 8], 12) == 3
  assert count_pairs([10, 10, 10, 10], 20) == 2
  assert count_pairs([], 10) == 0
  assert count_pairs([5, 5, 5, 5], 10) == 2
output: def count_pairs(numbers, x):
      count = 0
      i, j = 0, len(numbers) - 1
      while i < j: 
          sum = numbers[i] + numbers[j]
          if sum == x: 
              count += 1
              i += 1
          elif sum < x: 
              i += 1 
          else: 
              j -= 1
      return count