#include using namespace std; #define REP(i,n) for(int i=0; i<(int)(n); i++) vector divisor(long long n) { vector ret; for (long long i = 1; i * i <= n; i++) { if (n % i == 0) { ret.push_back(i); if (i != n / i) ret.push_back(n / i); } } return ret; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector a(n); REP (i, n) cin >> a[i]; int sum = 0; REP (i, n) sum += a[i]; vector ds = divisor(sum); int ret = 0; for (int d: ds) { int cnt = 0; int acc = 0; REP (i, n) { acc += a[i]; if (acc > d) { cnt = 0; break; } else if (acc == d) { cnt++; acc = 0; } } ret = max(ret, cnt); } cout << ret << endl; return 0; }