// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)

#define VL vector<ll>

#define VS vector<string>

#define VB vector<bool>

#define VP vector<pair<ll,ll>>

#define VVL vector<vector<ll>>

#define VVP vector<vector<pair<ll,ll>>>

#define PL pair<ll,ll>

#define ALL(v) (v).begin(), (v).end()

ll d1[4] = {1, -1, 0, 0};

ll d2[4] = {0, 0, 1, -1};



int main(){

    ll N;

    cin >> N;



    VL a(N);

    rep(i, 0, N) cin >> a[i];



    ll L = -1, R = 1e18;

    while(R - L > 1){

        VL tmp(a);

        ll M = L + (R - L)/2;

        ll c = 0;

        auto itr = max_element(ALL(tmp));

        while(*itr >= N){

            ll d = (ll)(*itr/N);

            c += d;

            *itr -= d * (N + 1);

            rep(t, 0, tmp.size()) tmp[t] += d;

            itr = max_element(ALL(tmp));

        }

        if(c <= M) R = M;

        else L = M; 

    }

    cout << R << endl;

    return 0;

}

// Optimized solution to the same problem (faster):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)



int main(){

    ll N;

    cin >> N;

    vector<ll> a(N);

    rep(i, 0, N) cin >> a[i];

    ll ans = 0;

    while(true){

        auto itr = max_element(a.begin(), a.end());

        if(*itr <= N-1) break;

        ll rem = *itr - (N - 1);

        ll red = (rem + N - 1)/N;

        *itr -= red * N;

        *itr -= red;

        ans += red;

        rep(i, 0, N) a[i] += red;

    }

    cout << ans << endl;

    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 ;

}