// yuki 944 煎っぞ! // 2019.12.7 bal4u #include #include int getchar_unlocked(void); #define gc() getchar_unlocked() int in() { // 非負整数の入力 int n = 0, c = gc(); do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0'); return n; } char f[10000005]; int ans = 1; void check(int w, int n) { int x = 0, m; if (n <= ans) return; m = n; while (n--) { x += w; if (f[x] == 0) return; } ans = m; } int main() { int i, b, s, N; N = in(); s = 0; while (N--) s += in(), f[s] = 1; b = (int)sqrt((double)s); for (i = 1; i <= b; ++i) if (s % i == 0) { check(i, s/i), check(s/i, i); } printf("%d\n", ans); return 0; }