import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop, core.stdc.stdio; void main() { auto N = readln.chomp.to!int; auto A = readln.split.map!(to!int).array; auto S = A.sum; int[] P; for (int i = 1; i * i <= S; ++i) { if (S % i == 0) { P ~= i; if (i * i != S) { P ~= S / i; } } } int ans = 0; foreach (p; P) { int cnt = 0; int tmp = 0; bool ok = true; foreach (a; A) { if (tmp + a > p) { ok = false; break; } else if (tmp + a == p) { cnt += 1; tmp = 0; } else { tmp += a; } } if (ok) { ans = max(ans, cnt); } } ans.writeln; }