#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned int N;
  int tmp = 0, count = 0, sum = 0;
  cin >> N;
  vector<int> A = {};
  for (int i = 0; i < N; i++) {
    cin >> tmp;
    A.push_back(tmp);
  }
  for (int i = 0; i < N; i++) {
    sum += A[i];
    for (int j = i + 1; j < N; j++) {
      sum += A[j];
      if (sum == 0) count++;
    }
    sum = 0;
  }
  cout << count << endl;
  return 0;
}
