#include <bits/stdc++.h>
#define lsb(x)
#define ll long long

using namespace std;

const int INF = (int) 1e9;
const int MAXN = (int) 50;

ll v[MAXN + 1];
ll vec[MAXN + 1];

vector < pair <int, int> > sol, aux;

int main() {
    //ifstream cin("A.in");
    //ofstream cout("A.out");
    int i, n;
    ios::sync_with_stdio(false);
    cin >> n;
    ll mn = INF, mx = -INF;
    int pmn, pmx;
    for(i = 1; i <= n; i++) {
        cin >> v[i];
        vec[i] = v[i];
        mn = min(mn, v[i]);
        if(mn == v[i])
            pmn = i;
        mx = max(mx, v[i]);
        if(mx == v[i])
            pmx = i;
    }
    if(mx > 0) {
        ll cnt = 0;
        for(i = 2; i <= n; i++) {
            if(vec[i] < vec[i - 1]) {
                cnt += (vec[i - 1] - vec[i] + mx - 1) / mx;
                vec[i] += 1LL * ((vec[i - 1] - vec[i] + mx - 1) / mx) * mx;
                if(vec[i] > mx) {
                    mx = vec[i];
                    pmx = i;
                }
            }
        }
        if(cnt <= 2 * n) {
            cnt = 0;
            mx = -INF;
            for(i = 1; i <= n; i++) {
                vec[i] = v[i];
                if(mx < vec[i]) {
                    mx = vec[i];
                    pmx = i;
                }
            }
            for(i = 2; i <= n; i++) {
                if(vec[i] < vec[i - 1]) {
                    cnt = (vec[i - 1] - vec[i] + mx - 1) / mx;
                    vec[i] += 1LL * ((vec[i - 1] - vec[i] + mx - 1) / mx) * mx;
                    while(cnt > 0) {
                        sol.push_back({pmx, i});
                        cnt--;
                    }
                    if(vec[i] > mx) {
                        mx = vec[i];
                        pmx = i;
                    }
                }
            }
        }
    }
     for(i = 1; i <= n; i++)
            vec[i] = v[i];
    if(mn < 0 && sol.empty()) {
        ll cnt = 0;
        mn = -mn;
        for(i = n - 1; i >= 1; i--) {
            if(vec[i] > vec[i + 1]) {
                cnt += (vec[i] - vec[i + 1] + mn - 1) / mn;
                vec[i] -= 1LL * ((vec[i] - vec[i + 1] + mn - 1) / mn) * mn;
                if(-mn > vec[i]) {
                    mn = -vec[i];
                    pmn = i;
                }
            }
        }
        if(cnt <= 2 * n) {
            cnt = 0;
            mn = INF;
            for(i = 1; i <= n; i++) {
                vec[i] = v[i];
                if(vec[i] < mn) {
                    mn = vec[i];
                    pmn = i;
                }
            }
            mn = -mn;
            for(i = n - 1; i >= 1; i--) {
                if(vec[i] > vec[i + 1]) {
                    cnt = (vec[i] - vec[i + 1] + mn - 1) / mn;
                    vec[i] -= 1LL * ((vec[i] - vec[i + 1] + mn - 1) / mn) * mn;
                    while(cnt > 0) {
                        sol.push_back({pmn, i});
                        cnt--;
                    }
                    if(-mn > vec[i]) {
                       mn = -vec[i];
                       pmn = i;
                    }
                }
            }
        }
    }
    cout << sol.size() << endl;
    for(auto it : sol)
        cout << it.first << " " << it.second << endl;
    //cin.close();
    //cout.close();
    return 0;
}


Measured memory_bytes: 256