input: Write a function to count the number of pairs in an array that sum up to a given value x. If the array 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, 6], 7) == 3
  assert count_pairs([1, 3, 3, 4, 5, 6], 6) == 2
  assert count_pairs([1, 2, 3, 4, 5, 6], 10) == 0
  assert count_pairs([], 10) == 0
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