{-# LANGUAGE MultiWayIf #-}

import Data.List (minimumBy)

showIs is it = show is++" "++show it

solveSimple [] _ = []
solveSimple ((a,i):as) (maxA,maxI) = showIs i maxI:solveSimple as (a+maxA,i)

solveRev [] _ = []
solveRev ((a,i):rs) (minA,minI) = showIs i minI:solveRev rs (a+minA,i)


main :: IO ()
main = do
  n <- read <$> getLine :: IO Int
  as <- map read.words <$> getLine :: IO [Int]
  let ais = zip as [1..] :: [(Int,Int)]
      (maxA,maxI) = maximum ais
      (minA,minI) = minimum ais
      ans = if | minA >= 0 -> solveSimple ais (maxA, maxI)
               | maxA < 0 -> solveRev (reverse ais) (minA, minI)
               | abs maxA >= abs minA ->
                  [showIs maxI i|(a,i)<-ais, a<0] ++
                  solveSimple (map (\(a,i)->if a < 0 then (a+maxA,i) else (a,i)) ais) (maxA, maxI)
               | otherwise ->
                  [showIs minI i|(a,i)<-ais, a>0] ++
                  solveRev (map (\(a,i)->if a >= 0 then (a+minA,i) else (a,i)) ais) (minA, minI)
  print $ length ans
  putStr $ unlines ans
