#include using namespace std; vector divisor(int n) { vector res; for (int i = 1; i * i <= n; i++) { if (n % i == 0) { res.push_back(i); if (i != n / i) res.push_back(n / i); } } return res; } int main() { int n; cin >> n; int sum = 0; vector a(n); for (int i = 0; i < n; i++) { cin >> a.at(i); sum += a.at(i); } vector div = divisor(sum); int maxi = 0; for (int d: div) { int v = sum / d; bool ok = true; int sum = 0; int cnt = 1; for (int i = 0; i < n; i++) { if (v < sum) { ok = false; break; } else if (v == sum) { sum = 0; cnt++; } sum += a.at(i); } if (sum != v) ok = false; if (ok) maxi = max(maxi, cnt); } cout << maxi << endl; }