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