#include using namespace std; int main(){ int N; cin >> N; vector a(N); for (int i = 0; i < N; i++){ cin >> a[i]; } vector s(N + 1, 0); for (int i = 0; i < N; i++){ s[i + 1] = s[i] + a[i]; } set st; for (int i = 0; i <= N; i++){ st.insert(s[i]); } vector f; for (int i = 1; i * i <= s[N]; i++){ if (s[N] % i == 0){ f.push_back(i); if (i * i < s[N]){ f.push_back(s[N] / i); } } } sort(f.begin(), f.end()); for (int x : f){ bool ok = true; for (int i = 0; i <= s[N]; i += x){ if (!st.count(i)){ ok = false; } } if (ok){ cout << s[N] / x << endl; break; } } }