fun readInts() = readLine()!!.split(" ").map(String::toInt)

fun main(args: Array<String>) {
  val n = readLine()!!.toInt()
  val xs = readInts()
  val max = xs.max()!!
  val min = xs.min()!!
  val outputs = mutableListOf<String>()

  fun processAllPos() {
    for (i in 1..(n - 1)) {
      outputs.add("$i ${i + 1}")
    }
  }

  fun processAllNeg() {
    for (i in n downTo 2) {
      outputs.add("$i ${i - 1}")
    }
  }

  if (min >= 0) {
    processAllPos()
  } else if (max <= 0) {
    processAllNeg()
  } else {
    if (Math.abs(max) >= Math.abs(min)) {
      val maxIndex = xs.indexOf(max) + 1
      for (i in 1..n) {
        outputs.add("$maxIndex $i")
      }
      processAllPos()
    } else {
      val minIndex = xs.indexOf(min) + 1
      for (i in 1..n) {
        outputs.add("$minIndex $i")
      }
      processAllNeg()
    }
  }
  println(outputs.size)
  outputs.forEach { println(it) }
}
