{-# LANGUAGE BangPatterns #-}
import Control.Arrow
import Control.Applicative
import Control.Monad.Fix
import Control.Monad.ST
import Data.Int
import Data.Foldable
import Data.List
import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.ByteString.Char8 as B
import Debug.Trace

solve :: Int -> VU.Vector Int -> (Int, [(Int, Int)])
solve !n !an = second (map (\(!x, !y) -> (x + 1, y + 1))) $ if ordered
  then (0, [])
  else
    let positiveOrder = abs maxOfPos > abs maxOfNeg
    in  toPair (bottomup positiveOrder ++ fold positiveOrder)
 where
  ordered = snd $ VU.foldr'
    (\(!ai) (!acc, !isit) -> if isit then (ai, acc >= ai) else (acc, isit))
    (maxBound, True)
    an

  (imaxOfPos, maxOfPos) =
    VU.maximumBy (\x y -> compare (snd x) (snd y)) $ VU.indexed an
  (imaxOfNeg, maxOfNeg) =
    VU.minimumBy (\x y -> compare (snd x) (snd y)) $ VU.indexed an

  toPair xs = (length xs, xs)

  bottomup isPositive = VU.ifoldl'
    (\(!acc) (!i) (!ai) -> case () of
      () | isPositive && ai < 0     -> (imaxOfPos, i) : acc
      () | not isPositive && ai > 0 -> (imaxOfNeg, i) : acc
      ()                            -> acc
    )
    []
    an

  fold leftToRight = if leftToRight
    then [ (i, i + 1) | i <- [0 .. n - 2] ]
    else [ (i, i - 1) | i <- reverse [1 .. n - 1] ]

main = do
  let readInt :: Integral a => B.ByteString -> Maybe (a, B.ByteString)
      readInt = fmap (first fromIntegral . second B.tail) . B.readInt

  n  <- (\vec -> (vec VU.! 0)) . VU.unfoldrN 1 readInt <$> B.getLine
  an <- VU.unfoldrN n readInt <$> B.getLine
  let (m, xs) = solve n an
  print m
  mapM_ (\(x, y) -> putStrLn $ show x ++ " " ++ show y) xs
