#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <numeric>
#include <functional>


/*
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::'''```````:::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::''`_,-''.,...  `::::::::::::::::::
:::::::::::::::::::::::::::::::::::::' _,-',;;!!!!!!!!!; `::::::::::::::::
::::::::::::::'`````:::::::::::::'' .-' ;<!!!!!!!'''`_..' `:::::::::::::::
::::::::::'' ,;!!!;,`::::::::::' .-`.,,,zcccc,,cccd$$"",;> `::::::::::::::
:::::::::' ;!!!!!!!!; ``:::::' ;' ,c$$$$$$$$$$$CC<<"  ````_ ::::::::::::::
:::::::' ;!!!!!!!!!!!!!;   ' ;! z$$$$$$$$$$$$$$$$$$$$$$??". ::::::::::::::
::::::: <!!!!!!!!!!!!!' .  .!',c$$$$$$$$$$$$$c, `"""',;;<!! ::::::::::::::
:::::: ,!!!!!!!!!!!'`,;! .<! ,$$$$$$$$$$$$$$$$hc,,,..- !!!! `:::::::::::::
::::'  <!!!!!!!!!' .<!!!;!! ,$$$$$""???$$$"""?????"" .<!!!! ::::::::::::::
::: ;><!!!!!!!!! ,<!!!!!!!',c,  "??.< . "??h. -;;;;!!!!!!!' ::::::::::::::
::: !!!!!!!!!!' ;!!!!!!!!' d$$h.`$ccr,$h `;,."  `!!!!!!!!! :::::::::::::::
:::.`<!!!!!!!' !!!!!!!!!! dP"""?.`$$F`$$h.`!!!!!!!!!!!!!! .:::::::::::::::
::::. <!!!!!! !!!!!!!!!! ,$ .nn.' "$$ P"   <!!!!!!!!!!!' .::::::::::::::::
:::::. <!!!! ;!!!!!!!!!! $$ MMMMx  ?$  ,dx `!!!!!!!!!!' ::::::::::::::::::
```:::: `!!! !!!'!!!!!!  `$ MMMMMM, $r MMMr !!!!!!!!' .:::::::::::::::::::
`!!;,.`' ``' ``,;!!!!' ch." 4MMMMMM "$ 4MMM `!!!!!' ..::::::::::::::::::::
!!!!!'````'``<!!!'`.z$$$$.  MMMMMMb $h MMM `!!''  .:::::::::::::::::::::::
..``.,d$$$$$c,,,. $$$$$F"?  "MMMMMM $$ 4P" '  . ::::::::::::::::::::::::::
dM""..""?$$$$$$$$$$$$$$$$$$c  "MM"   $$>`   ,c  `:::::::::::::::::::::::::
MMn.`"?hc,d$$$$$$$$$$$$$$$$$$. `P    $P'   -??P== `:::::::::::::::::::::::
MMMMMnx`"?$$$$$$$$$$$P".,.`"??$ccccc$.z$$$$.  `' .:::::::::::::::::'    ''
MMMMMM,' .?$$$$$$$$$$ d$$$    d$$$$$$$$$$$$$h..``::::::::::::::::'
MMMMMMMn `?$$$$$$$$$$,.?$$h. =."?$$$$$$$$$$$$$$hc,.``'::::::::::'
MMMMMMMM ;, `"??$$$$$$h  ?$$h. -m,``""??$$$$$$$$$$$$$c,.``````'
MMMMMMM> !!! ?cc,.,d$$$$h.`"?$hc   `P  .`"?$$$$$$$$$$$$$$$$$$$          .:
MMMMMMM ,!!'. $$$$$$$$$??=== `"""=c, " P  n. "$$$$$$$$$$$$$$$$c_    ,.::::
MMMMMMP !!! Mr<$$$$"".,c,;M ;<!! ..""=_ ' 4 .br .`""??$$$$$$$$??"".:::::::
MMMMMM';!!',M>'$$$$$$$$$>4M `!!! 4MMbn.`"=cc," -'P",c=.,.`.. .=  :::::::::
MMMMM' !!! dMb $$$$$$$$P MM> !!! 4MMMMMMr :..`"-._""Pr4"'-P" .,.`:::::::::
MMMM' <!!!,MMM "$$$$$$P dMM>;!!! 4MMMMMMb :::::.. "-=cczyycc??" .:::::::::
MMMP <!!! dMMMb "?$$P" uMMM>;!!! 4MMMMMMMr`:::::::::.........:::::::::::::
MMP';!!! ;MMMMMMn,.".uMMMMM ;!!! MMMMMMMMM,`::::::::::::::::::::::::::::::
MM ;!!!! MMMMMMMMMMMMMMMMMM !!!! MMMMMMMMMb `:::::::::::::::::::::::::::::
M" !!!! uMMMMMMMMMMMMMMMMMP !!! ;MMMMMMMMMMx :::::::::::::::::::::::::::::
P.!!!! ,MMMMMMMMMMMMMMMMMM ,!!! MMMMMMMMMMMMx`::::::::::::::::::::::::::::
!!!!> MMMMMMMMMMMMMMMMMMP !!!',MMMMMMMMMMMMM `:::::::::::::::::::::::::::
*/


int main()
{
	long long n, m;

	std::cin >> n;

	std::vector<long long> v(n);

	for (long long i = 0; i < n; i++) {
		std::cin >> v[i];
	}

	long long ans = 0, count = 0;

	while (true) {
		std::sort(v.begin(), v.end(), std::greater<long long>());
		if (v[0] < n) {
			break;
		}
		long long a = v[0] / n;
		v[0] %= n;
		ans += a;
		for (long long i = 1; i < n; i++) {
			v[i] += a;
		}
	}

	std::cout << ans << std::endl;

	return 0;
}

Measured memory_bytes: 384