#include <bits/stdc++.h>

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dump() fprintf(stderr, "#%s.%d\n", __func__, __LINE__);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumplll(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%ld, %ld, %ld)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
#define guard(x) if( not ( x ) ) continue;
typedef int64_t Int;
typedef std::vector<Int> LI;
const double pi = 3.14159265358979323846264338;
const Int mod = 1000000007;

template<typename T> void scan1(T& x) { fprintf(stderr, "unknown type\n"); }
template<> void scan1(Int& x) { if( scanf("%" PRId64, &x) < 0 ) exit(0); }
template<> void scan1(std::string& x) { if( not ( std::cin >> x ) ) exit(0); }
template<> void scan1(LI& xs) { for(Int &x : xs) scan1(x); }
void scan() {}
template<typename Head, typename... Tail>
void scan(Head& x, Tail&... xs) {
  scan1(x); scan(xs...);
}

template<typename T>
struct Maybe {
   T x;
   bool valid;
   Maybe() : valid(false) {}
   Maybe(T x_) : x(x_), valid(true) {}
   operator T() const {
      assert( valid );
      return x;
   }
};

struct Solver {
   Solver() { fprintf(stderr, "--------Solver begin--------\n"); }
   ~Solver() { fprintf(stderr, "--------Solver end--------\n"); }
   void solve() {
      Int n; scan(n);
      std::vector<Int> xs(n); scan(xs);
      Int minI = std::min_element(xs.begin(), xs.end()) - xs.begin();
      Int maxI = std::max_element(xs.begin(), xs.end()) - xs.begin();
      std::vector<std::pair<Int, Int>> res;
      if( std::abs(xs[minI]) < std::abs(xs[maxI]) ) {
         for(Int i = 0; i < n; ++i) {
            if( xs[i] < 0 ) {
               res.push_back(std::make_pair(maxI+1, i+1));
               // printf("%ld %ld\n", maxI+1, i+1);
               xs[i] += xs[maxI];
            }
         }
         for(Int i = 1; i < n; ++i) {
            if( xs[i-1] > xs[i] ) {
               res.push_back(std::make_pair(i-1+1, i+1));
               // printf("%ld %ld\n", i-1+1, i+1);
               xs[i] += xs[i-1];
            }
         }
      }
      else {
         for(Int i = 0; i < n; ++i) {
            if( xs[i] > 0 ) {
               res.push_back(std::make_pair(minI+1, i+1));
               // printf("%ld %ld\n", minI+1, i+1);
               xs[i] += xs[minI];
            }
         }
         for(Int i = n-1; i >= 1; --i) {
            if( xs[i-1] > xs[i] ) {
               res.push_back(std::make_pair(i+1, i-1+1));
               // printf("%ld %ld\n", i+1, i-1+1);
               xs[i-1] += xs[i];
            }
         }
      }
      printf("%ld\n", res.size());
      for(auto ab : res) {
         printf("%ld %ld\n", ab.first, ab.second);
      }
      for(Int x : xs) {
         dumpl(x);
      }
   }
};

int main() {
   loop std::unique_ptr<Solver>(new Solver())->solve();
}




Measured memory_bytes: 256