import core.bitop;
import std.algorithm;
import std.array;
import std.ascii;
import std.container;
import std.conv;
import std.format;
import std.math;
import std.random;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
  ulong n = readln.chomp.to!ulong;
  ulong[] a = readln.chomp.split.map!(to!ulong).array;
  // ulong[] a = make(50 * 10_000_000_000_000_000L);
  // ulong n = a.length;
  ulong k = 0;
  ulong cnt = 0;
  for (;;) {
    ulong trg = 0;
    ulong trg_index = 0;
    foreach (i, v; a) {
      if (trg < v) {
        trg = v;
        trg_index = i;
      }
    }
    if (trg < n) {
      break;
    }
    ulong sub = trg / n;
    k += sub;
    a[trg_index] -= sub * n;
    foreach (i, ref v; a) {
      if (i == trg_index) {
        continue;
      }
      v += sub;
    }
    ++cnt;
  }
  // stderr.writeln("loop count : ", cnt);
  k.writeln;
}

ulong[] make(ulong k)
{
  enum N = 50;
  long v = k / N;
  immutable remain = k % N;
  ulong[] arr;
  foreach (i; 0..N) {
    if (i < remain) {
      arr ~=  v + N * 2 - remain;
    } else {
      arr ~= v + N - (remain + 1);
    }
  }
  return arr;
}
