#include using namespace std; int main() { int n; cin >> n; vector s(n + 1); for (int i = 0; i < n; i++) { int a; cin >> a; s.at(i + 1) = s.at(i) + a; } for (int i = 1; i <= s.at(n); i++) { if (s.at(n) % i) continue; int prev = 0; for (int j = 0; j < n; j++) { if (s.at(j + 1) == prev + i) { prev = s.at(j + 1); } else if (s.at(j + 1) > prev + i) { break; } } if (prev == s.at(n)) { cout << s.at(n) / i << endl; return 0; } } }