from numpy import*

N,*A=open(0)

N,A,S,a=int(N),loadtxt(A,int),1,0

while S:B=A//N;S=sum(B);a+=S;A+=S-B*-~N

print(a)
N, *A = list(map(int, open(0).read().split()))



ans = 0

S = -1

while S:

    S = sum(a // N for a in A)

    ans += S

    A = [a % N + (S - a // N) for a in A]



print(ans)

from numpy import *

N, *A = open(0)
N, A, S, a = int(N), loadtxt(A, int), 1, 0
while S:
    B = A // N
    S = sum(B)
    a += S
    A += S - B * -~N
print(a)

N, *A = list(map(int, open(0).read().split()))
ans = 0
S = -1
while S:
    S = sum(a // N for a in A)
    ans += S
    A = [a % N + (S - a // N) for a in A]
print(ans)

-from numpy import * - -N, *A = open(0) -N, A, S, a = int(N), loadtxt(A, int), 1, 0 +N, *A = list(map(int, open(0).read().split())) +ans = 0 +S = -1 -    B = A // N -    S = sum(B) -    a += S -    A += S - B * -~N -print(a) +    S = sum(a // N for a in A) +    ans += S +    A = [a % N + (S - a // N) for a in A] +print(ans)