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 C++14 (GCC 5.4.1) (judge verdict: Time Limit Exceeded)

#include <bits/stdc++.h>

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)

bool isCheck(vector<lli> v){
	lli size = v.size();
	REP(i,1,size){
		if(v[i-1]>v[i])return false;
	}
	return true;
}

int main(){

	lli n;
	cin>>n;
	vector<lli> a(n);

	lli minNum=INF;
	lli minPos=0;
	lli maxPos=0;
	lli maxNum=-INF;
	REP(i,0,n){
		cin>>a[i];
		if(minNum >= a[i]){
			minNum = a[i];
			minPos = i;
		}
		if(maxNum <= a[i]){
			maxNum = a[i];
			maxPos=i;
		}
	}

	/*Nは50以下*/
	/*2*Nは100以下,操作は多くても100回まで*/
	/*1番小さい数と1番大きい数を保持しておく。*/
	/*1番小さい数と1番大きい数の絶対値を見て、*/
	/*下げるか上げるかを決定する*/

	lli flag=0;
	if(abs(minNum)>=abs(maxNum)){
		flag=1;
	}
	else flag=2;

	/*flag=1,minNumマイナスに動かした方がよい場合*/

	vector<pair<lli,lli>> ans;
	lli cnt=0;
	lli flag1[100]={0};
	REP(i,0,100)flag1[i]=0;
	if(flag==1){
		flag1[minPos]=1;
		while(!isCheck(a)){
			/*minNum以上の2番目に小さい数をたたき出す*/
			lli targetNum = INF;
			lli targetPos = -1;
			for(lli i=0;i<n;i++){
				if(flag1[i])continue;
				if(targetNum > a[i]){
					targetNum = a[i];
					targetPos=i;
				}
			}
			while(a[targetPos] > minNum){
				ans.push_back(mp(minPos+1,targetPos+1));
				a[targetPos] += minNum;
			}
			minNum = a[targetPos];
			minPos = targetPos;
			flag1[targetPos]=1;
		}
	}
	else{
		flag1[maxPos]=1;
		while(!isCheck(a)){
			/*minNum以上の2番目に小さい数をたたき出す*/
			lli targetNum = -INF;
			lli targetPos = -1;
			for(lli i=0;i<n;i++){
				if(flag1[i])continue;
				if(targetNum < a[i]){
					targetNum = a[i];
					targetPos=i;
				}
			}
			while(a[targetPos] < maxNum){
				ans.push_back(mp(maxPos+1,targetPos+1));
				a[targetPos] += maxNum;
			}
			maxNum = a[targetPos];
			maxPos = targetPos;
			flag1[targetPos]=1;
		}
	}
	cout<<ans.size()<<endl;
	REP(i,0,ans.size())cout<<ans.at(i).first<<" "<<ans.at(i).second<<endl;



	return 0;
}