// 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; int check(int w, int n) { int x = 0, nn; nn = n; while (n--) { x += w; if (f[x] == 0) return 0; } ans = nn; return 1; } int a[400], w; 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) { if (check(i, s/i)) goto OK; a[w++] = s/i; } while (--w) if (check(a[w], s/a[w])) break; OK: printf("%d\n", ans); return 0; }