output_description: Let m be the number of operations in your solution. In the first line, print
  m. In the i-th of the subsequent m lines, print the numbers x and y chosen in
  the i-th operation, with a space in between. The output will be considered
  correct if m is between 0 and 2N (inclusive) and a satisfies the condition
  after the m operations.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      a_1 a_2 ... a_{N}
attempt: def get_min_idx_val(A, N):
      min_val = A[0]
      min_idx = 0
      for i in range(N):
          if min_val > A[i]:
              min_val = A[i]
              min_idx = i
  
      return min_idx, min_val
  
  
  def get_max_idx_val(A, N):
      max_val = A[0]
      max_idx = 0
      for i in range(N):
          if max_val < A[i]:
              max_val = A[i]
              max_idx = i
  
      return max_idx, max_val
  
  
  def solve():
      N = int(input())
      A = list(map(int, input().split()))
      min_idx, min_A = get_min_idx_val(A, N)
      max_idx, max_A = get_max_idx_val(A, N)
      sign = 0
      if abs(min_A) <= abs(max_A):
          sign = 1
      else:
          sign = -1
  
      ret = 0
      query = []
      # print('sign:',sign)
      additive_idx = max_idx if sign > 0 else min_idx
      additive_val = max_A if sign > 0 else min_A
      # print(min_idx, max_idx, additive_idx, additive_val)
      for i in range(N):
          if A[i] * sign < 0:
              ret += 1
              query.append("{0} {1}".format(additive_idx + 1, i + 1))
              A[i] += additive_val
  
      if sign > 0:
          for i in range(1, N):
              first = i - 1
              second = i
              if A[first] > A[second]:
                  # if A[second] >= 0:
                  ret += 1
                  query.append("{0} {1}".format(first + 1, second + 1))
                  A[first] += A[second]
      elif sign < 0:
          for i in range(0, N - 1)[::-1]:
              first = i
              second = i + 1
              # print(first, second, A[first], A[second])
              if A[first] > A[second]:
                  # if A[first] <= 0:
                  ret += 1
                  query.append("{0} {1}".format(second + 1, first + 1))
                  A[first] += A[second]
  
      # print(A)
      output = """{0}
  {1}""".format(
          ret, "\n".join(query)
      )
      print(output)
  
  
  solve()
  
problem_description: Statement
  
  Snuke has an integer sequence, a, of length N. The i-th element of a
  (1-indexed) is a_{i}.
  
  He can perform the following operation any number of times:
  
    * Operation: Choose integers x and y between 1 and N (inclusive), and add a_x to a_y.
  
  He would like to perform this operation between 0 and 2N times (inclusive) so
  that a satisfies the condition below. Show one such sequence of operations. It
  can be proved that such a sequence of operations always exists under the
  constraints in this problem.
  
    * Condition: a_1 \leq a_2 \leq ... \leq a_{N}
samples: [{"input": "3\n    -2 5 -1", "output": "2\n    2 3\n    3 3\n    \n\n  * After the first operation, a = (-2,5,4).\n  * After the second operation, a = (-2,5,8), and the condition is now satisfied.\n\n* * *"}, {"input": "2\n    -1 -3", "output": "1\n    2 1\n    \n\n  * After the first operation, a = (-4,-3) and the condition is now satisfied.\n\n* * *"}, {"input": "5\n    0 0 0 0 0", "output": "0\n    \n\n  * The condition is satisfied already in the beginning."}]