// Original C++ solution (slower):
#include<iostream>

#include<cstdio>

#include<iomanip>

#include<algorithm>

#include<vector>

#include<set>

#include<list> 

#include<string>

#include<cstring>

#include<cmath>



#define vint vector<int>

#define vstr vector<string>

#define vll vector<long long>

#define ll long long

#define pf printf

#define sf scanf

#define sfd(n) scanf("%d", &n)

#define pfd(n) printf("%d", n);

#define pft	printf("\t")

#define pfn printf("\n")

#define pfk printf(" ")

#define N 200010

#define PI 3.1415926



using namespace std;



int main() {

	int n;

	sfd(n);

	ll* num = new ll[n];

	for( int i=0; i<n; i++ ) {

		sf("%lld", &num[i]);

	}

	ll cnt = 0;

	while( 1 ) {

		ll max = num[0];

		int pos = 0; 

		for( int i=0; i<n; i++ ) {

			if( max<num[i] ) {

				max = num[i];

				pos = i;

			}

		}

		if( num[pos]<n ) {

			break;

		}

		for( int i=0; i<n; i++ ) {

			if( i==pos ) {

				num[i] = max%n;

			}else {

				num[i] += max/n;

			}

		}

		cnt += max/n;

	}

	pf("%lld", cnt);

	

	return 0;

}


// Optimized solution to the same problem (faster):
/*

    数据量很小,直接模拟

    对最大的数-n,其他数+1,直到最大数都小于n

    问操作次数.

    数据量大时,二分也应该可以.

*/

#include<cstdio>

using namespace std;

typedef long long LL;

LL a[55];

int main(){

    LL n, ans = 0;

    scanf("%lld", &n);

    for (int i = 0; i < n;i++){

        scanf("%lld", a + i);

    }

    while(true){

        LL ma = a[0], pos = 0;

        for (int i = 1; i < n;i++){

            if(a[i]>ma){

                ma = a[i];

                pos = i;

            }

        }

        if(ma<n){

            break;

        }

        LL tmp = ma / n;

        a[pos] %= n;

        for (int i = 0; i < n;i++){

            a[i] += tmp;

        }

        a[pos] -= tmp;

        ans += tmp;

    }

    printf("%lld", ans);

    return 0;

}

// Fastest known solution for this problem:
#include <iostream>

//#include <iomanip>

//#include <string>

#include <vector>

//#include <algorithm>

//#include <utility>

//#include <set>

//#include <map>

//#include <queue>

//#include <deque>

//#include <bitset>

//#include <math.h>

using namespace std ;

using ll = long long ;

//using ld = long double ;

using vll = vector<ll> ;

//using vvll = vector<vll> ;

//using vc = vector<char> ;

//using vvc = vector<vc> ;

//using vb = vector<bool> ;

//using vvb = vector<vb> ;

//using pll = pair<ll,ll> ;\



//ll mod = 1000000007 ;

//ll INF = 10000000000 ;

//long double pie = acos(-1) ;



//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}

//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}

//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}

//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}

//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}

//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}

//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}





int main(){

	ll n ; cin >> n ;

	vll a(n) ;

	for(auto &i:a) cin >> i ;

	bool ok = true ;

	ll cnt = 0 ;

	while(ok){

		ok = false ;

		ll sum = 0 ;

		for(int i=0;i<n;i++){

			if(a.at(i)>=n){

				sum += a.at(i)/n ;

			}

		}

		ok = (sum!=0) ;

		if(ok){

			cnt += sum ;

			for(int i=0;i<n;i++){

				a.at(i) += (sum-a.at(i)/n)-a.at(i)/n*n ;

			}

		}

	}

	cout << cnt << endl ;

}