import std; int calc(int[] a) { int sum = a.sum; auto acc = a.cumulativeFold!"a + b".array.assumeSorted; for (int i = 0; i < acc.length; i++) { if (sum % acc[i] == 0) { bool ok = true; for (int j = acc[i] * 2; j < sum; j += acc[i]) { if (!acc.canFind(j)) { ok = false; break; } } if (ok) return sum / acc[i]; } } return 1; } void main() { readint; auto a = readints; writeln(calc(a)); } void scan(T...)(ref T a) { string[] ss = readln.split; foreach (i, t; T) a[i] = ss[i].to!t; } T read(T)() { return readln.chomp.to!T; } T[] reads(T)() { return readln.split.to!(T[]); } alias readint = read!int; alias readints = reads!int;