#include <bits/stdc++.h>
#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
    #include <filesystem>
    namespace fs = std::filesystem;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
static mt19937 _g(time(nullptr));
 
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N;
vector<ll> A;
void input(){
    fast_io();
    #ifdef __LOCAL
        fs::path __p = __FILE__;
        fs::path __input, __output;
        __input = __output = __p.parent_path();
        __input += string("/input/") + string(__p.stem()) + string(".txt");
        __output += string("/output/") + string(__p.stem()) + string(".txt");
        freopen(__input.c_str(), "r", stdin);
        freopen(__output.c_str(), "w", stdout);
    #endif
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        ll a; cin >> a;
        A.push_back(a);
    }
    
}

template< typename Monoid >
struct SegmentTree {
  using F = function< Monoid(Monoid, Monoid) >;

  int sz;
  vector< Monoid > seg;

  const F f;
  const Monoid M1;

  SegmentTree(int n, const F f, const Monoid &M1) : f(f), M1(M1) {
    sz = 1;
    while(sz < n) sz <<= 1;
    seg.assign(2 * sz, M1);
  }

  void set(int k, const Monoid &x) {
    seg[k + sz] = x;
  }

  void build() {
    for(int k = sz - 1; k > 0; k--) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  void update(int k, const Monoid &x) {
    k += sz;
    seg[k] = x;
    while(k >>= 1) {
      seg[k] = f(seg[2 * k + 0], seg[2 * k + 1]);
    }
  }

  Monoid query(int a, int b) {
    Monoid L = M1, R = M1;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
      if(a & 1) L = f(L, seg[a++]);
      if(b & 1) R = f(seg[--b], R);
    }
    return f(L, R);
  }

  Monoid operator[](const int &k) const {
    return seg[k + sz];
  }

  template< typename C >
  int find_subtree(int a, const C &check, Monoid &M, bool type) {
    while(a < sz) {
      Monoid nxt = type ? f(seg[2 * a + type], M) : f(M, seg[2 * a + type]);
      if(check(nxt)) a = 2 * a + type;
      else M = nxt, a = 2 * a + 1 - type;
    }
    return a - sz;
  }


  template< typename C >
  int find_first(int a, const C &check) {
    Monoid L = M1;
    if(a <= 0) {
      if(check(f(L, seg[1]))) return find_subtree(1, check, L, false);
      return -1;
    }
    int b = sz;
    for(a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
      if(a & 1) {
        Monoid nxt = f(L, seg[a]);
        if(check(nxt)) return find_subtree(a, check, L, false);
        L = nxt;
        ++a;
      }
    }
    return -1;
  }

  template< typename C >
  int find_last(int b, const C &check) {
    Monoid R = M1;
    if(b >= sz) {
      if(check(f(seg[1], R))) return find_subtree(1, check, R, true);
      return -1;
    }
    int a = sz;
    for(b += sz; a < b; a >>= 1, b >>= 1) {
      if(b & 1) {
        Monoid nxt = f(seg[--b], R);
        if(check(nxt)) return find_subtree(b, check, R, true);
        R = nxt;
      }
    }
    return -1;
  }
};


int solve(){
    vector<pll> act;
    pll e_min = make_pair(INT_MAX,0);
    pll e_max = make_pair(-INT_MAX,0);
    SegmentTree<pll> seg_min(N, [](pll a, pll b) { if(a.first<b.first) return a; else return b;}, e_min);
    SegmentTree<pll> seg_max(N, [](pll a, pll b) { if(a.first<b.first) return b; else return a;}, e_max);
    for (int i = 0; i < N; i++)
    {
        seg_max.update(i,{A[i],i});
        seg_min.update(i,{A[i],i});
    }
    pll Mx = seg_max.query(0,N);
    pll mn = seg_min.query(0,N);    
    // auto itrM = max_element(A.begin(),A.end());
    // auto itrm = min_element(A.begin(),A.end());
    // if(abs(*itrM)>=abs(*itrm)){
    if(abs(Mx.first)>=abs(mn.first) && Mx.first>0){
        // 前から
        for (int i = 0; i < N-1; i++)
        {
            if(A[i]<=A[i+1]) continue;
            else{
                // auto itrM = max_element(A.begin(),A.end());
                pll Mx = seg_max.query(0,N);
                while(A[i]>A[i+1]){
                    A[i+1] += Mx.first;
                    act.emplace_back(Mx.second,i+1);
                }
                seg_max.update(i+1,{A[i+1],i+1});
            }
        }

    }
    else{
        // 後ろから
        for (int i = N-1; i>0 ; i--)
        {
            if(A[i-1]<=A[i]) continue;
            else{
                // auto itrm = min_element(A.begin(),A.end());
                pll mn = seg_min.query(0,N);
                while(A[i-1]>A[i]){
                    // A[i-1] += *itrm;
                    A[i-1] += mn.first;
                    act.emplace_back(mn.second,i-1);
                }
                seg_min.update(i-1,{A[i-1],i-1});
            }
        }
    }
    DBG(A)
    cout << act.size() << "\n";
    for(auto a:act) cout << a.first+1 << " " << a.second+1 << "\n";
    
    return 0;
}   

void maketestcase(int n=50){
    #ifdef __LOCAL
        fs::path __p = __FILE__;
        fs::path __input, __output;
        __input = __output = __p.parent_path();
        __input += string("/input/") + string(__p.stem()) + string(".txt");
        __output += string("/output/") + string(__p.stem()) + string(".txt");
        // freopen(__input.c_str(), "r", stdin);
        freopen(__input.c_str(), "w", stdout);
    #endif
    cout << n << endl;
    for (int i = 0; i < n; i++)
    {
        cout << randint(-1e6,1e6) << " ";
    }
    cout << endl;
    
}

int main()
{
    input();
    solve();
    // maketestcase();
    return 0;
}


Measured memory_bytes: 256