#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a, b;
  int sum = 0, n, num = 0, x, i;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x;
    sum += x;
    a.push_back(x);
  }
  while (a.size() != 1 && b.size() != 1) {
    for (i = 0; i < a.size() - 1; i++) {
      if (sum == 0) num++;
      x = a[a.size() - 1 - i];
      sum -= x;
      b.push_back(x);
    }
    a.clear();
    sum = 0;
    for (i = 0; i < b.size(); i++) {
      x = b[b.size() - 1 - i];
      sum += x;
      a.push_back(x);
    }
    b.clear();
  }
  cout << num;
  return 0;
}
