n = int(eval(input()))

a = list(map(int, input().split()))



i = 0

ans = 0

while max(a) >= n:

    if a[i] >= n:

        cnt = a[i] // n

        ans += cnt

        a[i] -= n * cnt

        for j in range(n):

            if j == i:

                continue

            a[j] += cnt



    i = (i + 1) % n



print(ans)

import numpy as np



n = int(eval(input()))

a = np.array(input().split(), np.int64)





def check(x):

    cnt = np.maximum((a + x + 1) // (n + 1), 0)

    return cnt.sum() <= x





l = -1

r = 10 ** 18



while r - l > 1:

    m = (l + r) // 2

    if check(m):

        r = m

    else:

        l = m



for i in range(max(r - n * n, 0), r + 1):

    if check(i):

        print(i)

        exit()

n = int(eval(input()))
a = list(map(int, input().split()))
i = 0
ans = 0
while max(a) >= n:
    if a[i] >= n:
        cnt = a[i] // n
        ans += cnt
        a[i] -= n * cnt
        for j in range(n):
            if j == i:
                continue
            a[j] += cnt
    i = (i + 1) % n
print(ans)

import numpy as np

n = int(eval(input()))
a = np.array(input().split(), np.int64)


def check(x):
    cnt = np.maximum((a + x + 1) // (n + 1), 0)
    return cnt.sum() <= x


l = -1
r = 10**18
while r - l > 1:
    m = (l + r) // 2
    if check(m):
        r = m
    else:
        l = m
for i in range(max(r - n * n, 0), r + 1):
    if check(i):
        print(i)
        exit()

+import numpy as np + -a = list(map(int, input().split())) -i = 0 -ans = 0 -while max(a) >= n: -    if a[i] >= n: -        cnt = a[i] // n -        ans += cnt -        a[i] -= n * cnt -        for j in range(n): -            if j == i: -                continue -            a[j] += cnt -    i = (i + 1) % n -print(ans) +a = np.array(input().split(), np.int64) + + +def check(x): +    cnt = np.maximum((a + x + 1) // (n + 1), 0) +    return cnt.sum() <= x + + +l = -1 +r = 10**18 +while r - l > 1: +    m = (l + r) // 2 +    if check(m): +        r = m +    else: +        l = m +for i in range(max(r - n * n, 0), r + 1): +    if check(i): +        print(i) +        exit()