#include #include #include #include template std::vector divisors(T n) { std::vector ret; for (T p = 1; p * p <= n; ++p) { if (n % p != 0) continue; ret.push_back(p); if (n / p == p) continue; ret.push_back(n / p); } return ret; }; void solve() { int n; std::cin >> n; std::set s; int sum = 0; s.insert(sum); while (n--) { int x; std::cin >> x; s.insert(sum += x); } auto ps = divisors(sum); std::sort(ps.begin(), ps.end()); for (auto p : ps) { bool valid = true; for (int x = 0; x <= sum; x += p) { if (!s.count(x)) valid = false; } if (valid) { std::cout << sum / p << std::endl; return; } } } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }