#include <bits/stdc++.h>
using namespace std;
int main() {
  int N = 0;
  cin >> N;
  vector<int> vec(N);
  for (int i = 0; i < N; ++i) {
    cin >> vec.at(i);
  }
  int ritz = 0;
  int i, j = 0;
  int test = 0;
  for (i = 0; i < N; i += 2) {
    test = 0;
    for (j = 0; j < N - i; ++j) {
      test += vec.at(j + i);
      if (test == 0) {
        ++ritz;
      } else {
        if (j > 2) {
          if (test - vec.at(i) == 0) {
            ++ritz;
          }
        }
      }
    }
  }
  cout << ritz << endl;
}
