CodeEff/ECCO huggingface dataset:
# Original solution
ans = []
n = int(eval(input()))
while n > 0:
    i = n % 26
    if i == 0:
        i += 26
    ans.append(chr(i + 96))
    if n % 26 == 0:
        n = n // 26 - 1
    else:
        n //= 26
ans.reverse()
print(("".join(ans)))

# Optimized solution
n = int(eval(input()))
keta = 1
end = 0
while True:
    order = n - end
    end += 26**keta
    if n <= end:
        break
    keta += 1
order -= 1
ans = []
for i in range(keta):
    ans.append(chr(order%26 + 97))
    order //= 26
ans.reverse()
print(("".join(ans)))
# Original solution
N = int(eval(input()))

D = 26
lst = []
while N > 0:
    # c = N%26
    # if c == 0:
    #     ans += 'z'
    # else:
    #     ans += chr(ord('a') + (N%26) - 1)

    lst.append(N%D)
    N //= D

# print(lst)
ans = ""
z = False
for i in range(len(lst)):
    # print(i)
    if i == len(lst)-1 and lst[i] == 0:
        break

    if lst[i] == 0:
        ans += 'z'
        while lst[i+1] == 0:
            lst[i+1] = 25
            i+=1
        lst[i+1] -= 1
    else:
        ans += chr(ord('a') - 1 + lst[i])


# for c in enulst:
#     if c == 0:
#         z=True
#     else:
#         if z:
#             ans += chr(ord('z') + 1 - c)
#         else:
#             ans += chr(ord('a') - 1 + c)

# print(lst)
# print("rev:", list(reversed(lst)))
# print(ans)
print(("".join(list(reversed(ans)))))

# Optimized solution
N = int(eval(input()))

ans = ""
while N > 0:
    N-=1
    ans += chr(ord('a') + N%26)
    N//=26
print((ans[::-1]))
# Original solution
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(eval(input()))

import string
from collections import deque

name_table = 'z' + string.ascii_lowercase
ans = deque()


while n > 0:
    q = n // 26
    m = n % 26
    ans.appendleft(name_table[m])
    if m == 0:
        n = q - 1
    else:
        n = q

print((''.join(ans)))


# Optimized solution
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(eval(input()))

import string
from collections import deque

name_table = string.ascii_lowercase
ans = deque()


while n > 0:
    n -= 1
    m = n % 26
    ans.appendleft(name_table[m])
    n //= 26

print((''.join(ans)))
# Original solution
def encode(x):
    return chr(x + 97)


N = int(eval(input())) - 1
ans = []
while True:
    q, r = divmod(N, 26)
    ans.append(r)
    if q == 0:
        break
    N //= 26
    N -= 1
print(("".join(map(encode, ans[::-1]))))


# Optimized solution
def encode(x):
    return chr(x + 97)


def solve(N):
    N -= 1
    ans = []
    while True:
        q, r = divmod(N, 26)
        ans.append(r)
        if q == 0:
            break
        N //= 26
        N -= 1
    return "".join(map(encode, ans[::-1]))


print((solve(int(eval(input())))))
# Original solution
import math


def nextString(text, p):
    if text[p] != 'z':
        text[p] = chr(ord(text[p])+1)
        return text
    else:
        text[p] = 'a'
        nextString(text, p - 1)

n = int(eval(input()))
base = 26

digit = math.floor(math.log(1+(base-1)*n, base))

position = int(n - (base**digit - 1) / (base  - 1))

txt = 'a' * digit

txt = list(txt)

for i in range(digit):
    txt[digit - i - 1] = chr(ord(txt[digit - i - 1])+(position % base))
    position = position // base

print((''.join(txt)))


# Optimized solution
import math

n = int(eval(input()))
base = 26

digit = math.floor(math.log(1+(base-1)*n, base))
position = int(n - (base**digit - 1) / (base  - 1))

txt = 'a' * digit

txt = list(txt)

for i in range(digit):
    txt[digit - i - 1] = chr(ord(txt[digit - i - 1])+(position % base))
    position = position // base

print((''.join(txt)))
# Original solution
N = int(eval(input()))
alpha = list('zabcdefghijklmnopqrstuvwxy')
ans = ''


def dfs(n):
    global ans
    if n <= 26:
        ans += alpha[n%26]
        return ans[::-1]
    else:
        ans += alpha[n % 26]
        if n % 26 == 0:
            nn = n // 26 - 1
        else:
            nn = n // 26
        return dfs(nn)

print((dfs(N)))

# Optimized solution
N = int(eval(input()))
alpha = list('zabcdefghijklmnopqrstuvwxy')
ans = ''

while N:
  n = N % 26
  ans += alpha[n]
  N //= 26
  N -= n == 0

print((ans[::-1]))
# Original solution
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(eval(input()))
def inputMap(): return list(map(int, input().split()))
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	N = inputInt()

	print((num2alpha(N).lower()))


def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()


# Optimized solution
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(eval(input()))
def inputMap(): return list(map(int, input().split()))
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	N = inputInt()
	ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
	soezi = [i for i in range(26)]
	soezi = [26] + soezi

	ans = ""
	tmp = N
	while True:
		if tmp == 0:
			break
		tmp2 = tmp % 26
		ans = ascii_lowercase[tmp2-1] + ans

		tmp = tmp - soezi[tmp2]
		tmp = tmp // 26

	print(ans)



#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()
# Original solution
N = int(eval(input()))

ans = []
lst = []
n = N

while n > 26:
    x = n%26
    if x == 0:
        n = n//26 - 1
    else:
        n = n//26
    lst.append(x)


for i in range(len(lst)):
    x = lst[i]
    if x == 0:
        y = chr(97+25)
    else:
        y = chr(97 + x-1)
    ans.append(y)

ans.append(chr(97 + n-1))

ans = ans[::-1]

ans = ''.join(ans)
print(ans)


# Optimized solution
n = int(eval(input()))
ans = ""
while n:
    n -= 1
    ans += chr(n%26+ord("a"))
    n //= 26

print((ans[::-1]))
# Original solution
import sys
from string import ascii_lowercase

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())

    ans = []
    while N:
        N, r = N // 26, N % 26
        if r == 0:
            r = 26
            N -= 1
        ans.append(ascii_lowercase[r - 1])

    print((''.join(reversed(ans))))
    return


if __name__ == '__main__':
    main()


# Optimized solution
import sys
from string import ascii_lowercase

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())

    ans = []
    while N:
        N, r = (N - 1) // 26, (N - 1) % 26
        ans.append(ascii_lowercase[r])

    print((''.join(reversed(ans))))
    return


if __name__ == '__main__':
    main()
# Original solution
n=int(eval(input()))
a="abcdefghijklmnopqrstuvwxyz"
b=""
i=1
while n/26>0:
  if n%26==0:
    b="z"+b
  else:
    b=a[n%26-1]+b
    n=n//26
print(b)

# Optimized solution
n=int(eval(input()))
a="zabcdefghijklmnopqrstuvwxy"
b=""
while n/26>0:
  b=a[n%26]+b
  n=(n-1)//26
print(b)
# Original solution
def actual(N, A):
    return N ** 2 - A

N = int(eval(input()))
A = int(eval(input()))
print((actual(N, A)))

# Optimized solution
N = int(eval(input()))
A = int(eval(input()))

answer = (N * N) - A

print(answer)
# Original solution
N=int(eval(input()))

print(((N*N)-int(eval(input()))))

# Optimized solution

N=int(eval(input()))
A=int(eval(input()))

print(((N**2)-A))
# Original solution
n = int(eval(input()))
a = int(eval(input()))

y = n * n
x = y - a

print(x)

# Optimized solution
n = int(eval(input()))
a = int(eval(input()))

print((n * n - a))
# Original solution
N=int(eval(input()))
A=int(eval(input()))
print((N**2-A))

# Optimized solution
n=int(eval(input()))
a=int(eval(input()))
print((n*n-a))
# Original solution
n = int(eval(input()))
a = int(eval(input()))
print((n**2-a))

# Optimized solution
n = int(eval(input()))
a = int(eval(input()))
print(((n**2)-a))
# Original solution
a = int(eval(input()))
b = int(eval(input()))
print((a * a - b))


# Optimized solution
a = int(eval(input()))
print((a * a - int(eval(input()))))
# Original solution
n=sorted([int(eval(input())) for _ in range(int(eval(input())))],reverse=True);print((max(n)//2+sum(n[1:])))

# Optimized solution
n=sorted([int(eval(input())) for _ in range(int(eval(input())))],reverse=True);print((sum(n)-max(n)//2))
# Original solution
a=int(eval(input()));lis=[int(eval(input())) for i in range(a)]
print((int(max(lis)/2+sum(lis)-max(lis))))

# Optimized solution
lis=[int(eval(input()))for i in range(int(eval(input())))];print((int(max(lis)/2+sum(lis)-max(lis))))
# Original solution
n = int(eval(input()))
p = list(int(eval(input())) for _ in range(n))
p.append(p.pop(p.index(max(p))) // 2)
print((sum(p)))

# Optimized solution
def answer(n: int, p: []) -> int:
    p.append(p.pop(p.index(max(p))) // 2)
    return sum(p)


def main():
    n = int(eval(input()))
    p = list(int(eval(input())) for _ in range(n))
    print((answer(n, p)))


if __name__ == '__main__':
    main()
# Original solution
_,*p=list(map(int,open(0)));print((sum(p)-max(p)//2))

# Optimized solution
N = int(eval(input()))
pl = tuple(int(eval(input()))for _ in range(N))
p_mx = max(pl)//2
ans = sum(pl) - p_mx
print(ans)
# Original solution
N = int(eval(input()))
p_array = []
for _ in range(N):
  price = int(eval(input()))
  p_array.append(price)

#合計
price_sum = sum(p_array)
#最大値の半分の値（/ではなく//を使用しているのはint型にするため）
discount = max(p_array)//2

print((price_sum - discount))

# Optimized solution
N = int(eval(input()))
p_array = []
price_sum = 0
price_max = 0
for _ in range(N):
    price = int(eval(input()))
    #都度、足していく
    price_sum += price
    #都度、最大値を更新していく
    price_max = max(price, price_max)

print((price_sum - price_max//2))
# Original solution
# -*- coding: utf-8 -*-


def main():
    n = int(eval(input()))
    p = sorted([int(eval(input())) for _ in range(n)])

    # See:
    # https://img.atcoder.jp/abc115/editorial.pdf
    print((sum(p) - max(p) // 2))


if __name__ == '__main__':
    main()


# Optimized solution
# -*- coding: utf-8 -*-


def main():
    n = int(eval(input()))
    p = [int(eval(input())) for _ in range(n)]
    print((sum(p) - max(p) // 2))


if __name__ == '__main__':
    main()
# Original solution
n = int(eval(input()))
p = [int(eval(input())) for i in range(n)]
print((sum(p)-max(p)//2))

# Optimized solution
n = int(eval(input()))
P = [int(eval(input())) for i in range(n)]

print((sum(P)-max(P)//2))
# Original solution
N=int(eval(input()))
c=[0]*N
for i in range(N):
  c[i] =int(eval(input()))
  
print((int(sum(c)-max(c)//2)))

# Optimized solution
ri = lambda: int(eval(input()))
rl = lambda: list(map(int,input().split()))

N=ri()
p=[0]*N
for i in range(N):
    p[i] = ri()

print((sum(p)-max(p)//2))
# Original solution
N = int(eval(input()))
P = sorted([int(eval(input())) for x in range(N)])

m = P[N-1]
P = P[:N-1]
print((sum(P) + m // 2))

# Optimized solution
N = int(eval(input()))
m, *P = sorted([int(eval(input())) for x in range(N)], reverse=True)

"""
m = P[N-1]
P = P[:N-1]
"""

print((sum(P) + m // 2))
# Original solution
# coding: utf-8
N = int(eval(input()))
p = [ int(eval(input())) for _ in range(N)]
m = max(p)//2
p[p.index(max(p))] = 0
print((sum(p)+m))

# Optimized solution
# coding: utf-8
p = [ int(eval(input())) for _ in range(int(eval(input())))]
print((sum(p)-max(p)//2))
# Original solution
_,*a=list(map(int,open(0).readlines()));print((sum(a)-max(a)//2))

# Optimized solution
n,*p=list(map(int,open(0).read().split()))
print((sum(sorted(p)[:-1])+sorted(p)[-1]//2))
# Original solution
n = int(eval(input()))
nums =[]
for i in range(n):
    nums.append(int(eval(input())))

m = max(nums)
nums.remove(m)
print((int(sum(nums) + (m / 2))))


# Optimized solution
N = int(eval(input()))
nums = []
for i in range(N):
    nums.append(int(eval(input())))
m = max(nums)
nums.remove(m)
print((int(sum(nums) + (m / 2))))
# Original solution
x = sorted([int(eval(input())) for i in range(int(eval(input())))], reverse=True)
print((x[0]//2 + sum(x[1:])))

# Optimized solution
p = [int(eval(input())) for i in range(int(eval(input())))]
print((sum(p)-(max(p)//2)))
# Original solution
N = int(eval(input()))
p = sorted([int(eval(input())) for _ in range(N)])

print((int(sum(p[0:N-1]) + p[N-1]/2)))


# Optimized solution
N = int(eval(input()))

P = [int(eval(input())) for _ in range(N)]


P.sort()


print((sum(P[0:N-1])+P[N-1]//2))
# Original solution
N = int(eval(input()))

p = []
for _ in range(N):
  p.append(int(eval(input())))

p = sorted(p, reverse=True)
p[0] = p[0] // 2

total = 0
for value in p:
  total = total + value

print(total)

# Optimized solution
N = int(eval(input()))
p = sorted([int(eval(input())) for _ in range(N)], reverse=True)
print((p[0] // 2 + sum(p[1:])))
# Original solution
n = int(eval(input()))
ans = []
for i in range(n):
    ans.append(int(eval(input())))
ans.sort()
ans[-1]//=2
print((sum(ans)))

# Optimized solution
n = int(eval(input()))
a = [int(eval(input())) for i in range(n)]
print((sum(a)-max(a)//2))
# Original solution
l=[int(eval(input())) for _ in range(int(eval(input())))]
print((sum(l)-int(max(l)/2)))

# Optimized solution
n=int(eval(input()))
p=sorted([int(eval(input())) for i in range(n)])
print((p[-1]//2+sum(p[:-1])))
# Original solution
n=int(eval(input()))
a=[int(eval(input())) for i in range(n)]
print((int(sum(a)-max(a)/2)))

# Optimized solution
N = int(eval(input()))
L = [int(eval(input())) for i in range(N)]
print((sum(L)-int(max(L)/2)))
# Original solution
import itertools
import math
import fractions
import functools
import copy

n = int(eval(input()))
p = []
for i in range(n):
    p.append(int(eval(input())))

print((sum(p)-max(p)//2))

# Optimized solution
def main():
    n = int(eval(input()))
    # t, a = map(int, input().split())
    # h = list(map(int, input().split()))
    # s = input()

    p = []
    for i in range(n):
        p.append(int(eval(input())))
    
    maxi = max(p)
    print((sum(p) - maxi//2))



if __name__ == '__main__':
    main()
# Original solution
n,*p=list(map(int,open(0).read().split()));print((sum(p)-max(p)//2))

# Optimized solution
_,*p=list(map(int,open(0).readlines()));print((sum(p)-max(p)//2))
# Original solution
n = int(eval(input()))
p = [int(eval(input())) for _ in range(n)]
p.sort()
print((sum(p) - p[len(p)-1] + p[len(p)-1] // 2))


# Optimized solution
n = int(eval(input()))
p = [int(eval(input())) for _ in range(n)]
p.sort()
print((sum(p[:-1]) + p[-1] // 2))
# Original solution
a,*n=list(map(int,open(0)));print((int(sum(n)-max(n)/2)))

# Optimized solution
a,*n=list(map(int,open(0)));print((sum(n)-max(n)//2))
# Original solution
n = sorted(map(int, [eval(input()) for _ in range(int(eval(input())))]))
max_price_half = n[-1] / 2
total = sum(n) - n.pop(-1) + max_price_half
print((int(total)))


# Optimized solution
n = sorted(map(int, [eval(input()) for _ in range(int(eval(input())))]))
print((sum(n[:-1]) + n[-1] // 2))
# Original solution
l=int(eval(input()))
b=[int(eval(input())) for i in range(l)]
print((sum(b)-max(b)//2))

# Optimized solution
l=int(eval(input()))
b=[int(eval(input())) for i in range(l)]
print((int(sum(b)-max(b)/2)))
# Original solution
N = int(eval(input()))
p = []

for i in range(N):
    p.append(int(eval(input())))
    
mxi = p.index(max(p))
p[mxi] = p[mxi]//2
s = 0
for i in range(N):
    s = s+p[i]

print(s)

# Optimized solution
N = int(eval(input()))
p = [0]*N
s = 0

for i in range(N):
   p[i] = int(eval(input()))
   s = s + p[i]
   
print((s-max(p)//2))
# Original solution
N = int(eval(input()))
P = [int(eval(input())) for X in range(0,N)]
P[P.index(max(P))] = max(P)//2
print((sum(P)))

# Optimized solution
N = int(eval(input()))
P = sorted([int(eval(input())) for X in range(0,N)])
P[-1] = P[-1]//2
print((sum(P)))
# Original solution
n = int(eval(input()))
p = [int(eval(input())) for i in range(n)]
p.sort(reverse=True)
ans = 0
for t in p:
    ans += t
print((int(ans - p[0] / 2)))


# Optimized solution
l = [int(eval(input())) for i in range(int(eval(input())))]
print((int(sum(l) - max(l)/2)))
# Original solution
N=int(eval(input()))
P=[int(eval(input())) for i in range(N)]
print((round(sum(P)-1/2*max(P))))

# Optimized solution
n=int(eval(input()))
A=[int(eval(input())) for i in range(n)]
print((sum(A)-max(A)//2))
# Original solution
import sys
input = sys.stdin.readline
N = int(eval(input()))
a = list(map(int, input().split()))
a.sort()
def check(x):
  b = [0] * N
  for i in range(N):
    b[i] = a[i] + x
  t = x
  for i in range(N):
    if t * (N + 1) >= b[i] - (N - 1):
      t -= -(-(b[i] - (N - 1)) // (N + 1))
    else:
      return False
  return True


ok = sum(a)
ng = -1

while ok - ng > 1:
  m = (ok + ng) // 2
  isok = 0
  for i in range(50):
    if check(m + i):
      isok = 1
      break
  if isok: ok = m
  else: ng = m


for i in range(50):
  if check(ok + i):
    print((ok + i))
    break

# Optimized solution
import sys
input = sys.stdin.readline
N = int(eval(input()))
a = list(map(int, input().split()))

def check(x):
  b = a[: ]
  for i in range(N):
    b[i] += x
  c = 0
  for i in range(N):
    t = max(0, b[i] - (N - 1))
    c += -(-t // (N + 1))
  return c <= x

ok = sum(a)
ng = -1
while ok - ng > 1:
  m = (ok + ng) // 2
  isok = 0
  for i in range(N):
    if check(m + i):
      isok = 1
      break
  if isok: ok = m
  else: ng = m
for i in range(N):
  if check(ok + i):
    print((ok + i))
    break
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
flag = True
while flag:
    flag = False
    for i in range(N):
        if A[i] >= N:
            count = A[i] // N
            ans += count
            for j in range(N):
                A[j] += count
            A[i] -= count
            A[i] %= N
            flag = True
            break

print(ans)


# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
ans = 0
flag = True
while flag:
    flag = False
    for i in range(N):
        if A[i] >= N:
            count = A[i] // N
            ans += count
            for j in range(N):
                A[j] += count
            A[i] -= count
            A[i] %= N
            flag = True

print(ans)
# Original solution
N=int(eval(input()))
a=[int(i) for i in input().split()]
ans=0
while True:
  f=0
  for i in range(N):
    if a[i]>=N:
      d=a[i]//N
      ans+=d
      a[i]%=N
      for j in range(N):
        if i!=j:
          a[j]+=d
      f=1
      break
  if f==0:
    break
print(ans)
      
  
        

# Optimized solution
N=int(eval(input()))
a=[int(i) for i in input().split()]
ans=0
while True:
  f=0
  for i in range(N):
    if a[i]>=N:
      d=a[i]//N
      ans+=d
      a[i]%=N
      for j in range(N):
        if i!=j:
          a[j]+=d
    else:
      f+=1
  if f==N:
    break
print(ans)
# Original solution
# coding: utf-8
INF = 10 ** 20
MOD = 10 ** 9 + 7


def II(): return int(eval(input()))


def ILI(): return list(map(int, input().split()))


def read():
    N = II()
    a = ILI()
    return (N, a)


def check_a(N, a):
    for i, _a in enumerate(a):
        if _a >= N:
            return i
    return -1


def solve(N, a):
    ans = 0
    while True:
        ret_ind = check_a(N, a)
        if ret_ind == -1:
            break
        div, mod = divmod(a[ret_ind], N)
        for i in range(N):
            if i == ret_ind:
                a[i] = mod
                continue
            a[i] += div
        ans += div

    return ans


def main():
    params = read()
    print((solve(*params)))


if __name__ == "__main__":
    main()


# Optimized solution
# coding: utf-8
INF = 10 ** 20
MOD = 10 ** 9 + 7


def II(): return int(eval(input()))


def ILI(): return list(map(int, input().split()))


def read():
    N = II()
    a = ILI()
    return (N, a)


def check_a(N, a):
    for _a in a:
        if _a >= N:
            return False
    return True


def solve(N, a):
    ans = 0
    while True:
        if check_a(N, a):
            break

        l_div, l_mod = [None] * N, [None] * N
        for i, _a in enumerate(a):
            l_div[i], l_mod[i] = divmod(_a, N)

        sum_div = sum(l_div)
        for i in range(N):
            a[i] = l_mod[i] + sum_div - l_div[i]

        ans += sum_div

    return ans


def main():
    params = read()
    print((solve(*params)))


if __name__ == "__main__":
    main()
# Original solution
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import *
from bisect import bisect
 
def read():
  return int(eval(input()))
 
def reads():
  return [int(x) for x in input().split()]

N = read()
A = [a-(N-1) for a in reads()]

def possible(x): # possible in x turns exactly
  return sum((a + x + N) // (N+1) for a in A if a + x > 0) <= x
# possible(x) -> possible(x+N)

l = -1; r = 10 ** 19
while r - l > 1:
  m = (l + r) // 2
  if possible(m):
    r = m
  else:
    l = m
ans = min(x for x in range(l - 10*N**2, l + 10*N**2) if possible(x))
print(ans)



# Optimized solution
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import *
from bisect import bisect
 
def read():
  return int(eval(input()))
 
def reads():
  return [int(x) for x in input().split()]

N = read()
A = [a-(N-1) for a in reads()]

def possible(x): # possible at exactly x-th turn
  return sum((a + x + N) // (N+1) for a in A if a + x > 0) <= x

l = -1; r = 10 ** 19
while r - l > 1:
  m = (l + r) // 2
  if possible(m):
    r = m
  else:
    l = m
ans = min(x for x in range(l - 10*N**2, l + 10*N**2) if possible(x))
print(ans)
# Original solution
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)


# Optimized solution
def main():
    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)

main()
# Original solution
N = int(eval(input()))
A = list(map(int,input().split()))

ans = 0
while any([a>N-1 for a in A]):
    A.sort()
    d = A[-1] - (N-1)
    k = -(-d//N)
    ans += k
    A[-1] -= k*N
    for i in range(N-1):
        A[i] += k
print(ans)

# Optimized solution
N = int(eval(input()))
A = list(map(int,input().split()))

ans = 0
while any([a>N-1 for a in A]):
    for i in range(N):
        if A[i] <= N-1: continue
        d = A[i] - (N-1)
        k = -(-d//N)
        A[i] -= k*N
        ans += k
        for j in range(N):
            if j==i: continue
            A[j] += k
print(ans)