{-# LANGUAGE MultiWayIf #-}

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

solve [] _ = []
solve ((a,i):as) (a1,i1) = showIs i1 i:solve as (a+a1,i)


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