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

solve :: Int -> VU.Vector Int -> Int
solve !n !an = if check 0
  then 0
  else let s = findInternal in binsearch (s `div` 2) s
 where
  check !k = (<= k) $ VU.sum $ VU.map
    (\ai -> if ai < n
      then 0
      else floor $ fromIntegral (ai + k + 1) / fromIntegral (n + 1)
    )
    an

  findInternal = head $ dropWhile (\(!n) -> not . check $ n) $ map (2 ^) [0 ..]

  -- search in (x,y]
  binsearch !x !y
    | y - x == 1
    = y
    | otherwise
    = let !z = (x + y) `div` 2
      in  if check z then binsearch x z else binsearch z y

main = do
  let readInt = fmap (second B.tail) . B.readInt

  n  <- (\vec -> (vec VU.! 0)) . VU.unfoldrN 1 readInt <$> B.getLine
  an <- VU.unfoldrN n readInt <$> B.getLine
  print $ solve n an
