#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int A[n];
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  long long int sum = 0;
  long long int counter = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n - i; j++) {
      sum += A[j];
      if (sum == 0) {
        counter += 1;
      }
    }
    sum = 0;
  }
  cout << counter << endl;
  return 0;
}
