import Control.Applicative
import Data.List
import Data.Ratio
import Debug.Trace

main = do
  n <- readLn :: IO Integer
  xs <- map read . words <$> getLine :: IO [Integer]
  let s = sum xs

  print $ head [k | k<-[s-n*(n-1)..s], k>=0, (sum $ map (\x -> ceiling $ (x+k-(n-1)) % (n+1)) xs) == k]

