Problem:
Score : 600 points

Problem 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}

Constraints

2 \leq N \leq 50

-10^{6} \leq a_i \leq 10^{6}

All input values are integers.

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 ... a_{N}

Output

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.

Sample Input 1

3
-2 5 -1

Sample Output 1

2
2 3
3 3

After the first operation, a = (-2,5,4).

After the second operation, a = (-2,5,8), and the condition is now satisfied.

Sample Input 2

2
-1 -3

Sample Output 2

1
2 1

After the first operation, a = (-4,-3) and the condition is now satisfied.

Sample Input 3

5
0 0 0 0 0

Sample Output 3

0

The condition is satisfied already in the beginning.

Solution in Python (3.4.3) (judge verdict: Accepted)

import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

N = int(sys.stdin.readline())
list_a = list(map(int, sys.stdin.readline().split()))

a_max = max(list_a)
a_min = min(list_a)

ans = []

if (a_max == a_min):
    cnt = 0
elif (math.fabs(a_max) > math.fabs(a_min)):
    # for a in list_a:
    #     a += math.fabs(a_max)
    newList = [item + a_max for item in list_a]
    # print(newList)
    for i in range(N):
        # print(format(list_a.index(max(list_a))+1) + " " + format(i+1))
        ans.append((list_a.index(max(list_a))+1, i+1))

    newList2 = newList
    for i in range(N-1):
        # if (newList2[i] > newList2[i+1]):
            newList2[i+1] += newList2[i]
            ans.append((i+1, i+2))


else:
    # for a in list_a:
    #     a -= math.fabs(a_min)
    newList = [item + a_min for item in list_a]
    for i in range(N):
        # print(format(list_a.index(min(list_a))+1) + " " + format(i+1))
        ans.append((list_a.index(min(list_a))+1, i+1))

    newList2 = newList
    # for i in range(N-1):
    #     if (newList2[(N-1)-i] < newList2[(N-1)-(i+1)]):
    #         newList2[(N-1)-(i+1)] += newList2[(N-1)-i]
    #         # print(format((N-1)-i+1) + " " + format((N-1)-i))
    #         ans.append(((N-1)-i+1, (N-1)-i))
    for i in range(N-1, 0, -1):
        # if (newList2[i] < newList2[i-1]):
            newList2[i-1] += newList2[i]
            ans.append((i+1, i))

# print(list_a)
# print(newList)

print(len(ans))
for i in range(len(ans)):
    s, t = ans[i]
    print(s, t)