#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> mikako(N);
  for (int i = 0; i < N; i++) {
    cin >> mikako.at(i);
  }
  int count = 0;
  for (int i = 0; i < N - 1; i++) {
    int A = mikako.at(i);
    for (int j = i + 1; j < N; j++) {
      A += mikako.at(j);
      if (A == 0) {
        count++;
      }
    }
  }
  cout << count << endl;
}
