import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;
import std.container;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

void main(){
	long n = read.to!long;
	long[] as = readln.split.map!(to!long).array;
	
	as.sort!"a>b"();
	
	const long th = 1000;
	long count = 0;
	
	debug as.writeln;
	
	while(as[0] >= th + n){
		long k = (as[0] - th) / n;
		count += k;
		as[0] -= k * n;
		for(int j = 1; j < as.length; j ++) as[j] += k * 1;
		debug as.writeln;
		as.sort!"a>b"();
		}
	
	while(as[0] >= n){
		count += 1;
		as[0] -= n;
		for(int j = 1; j < as.length; j ++) as[j] += 1;
		debug as.writeln;
		as.sort!"a>b"();
		}
	
	count.writeln;
	}