#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int count = 0;
  int length = 0;
  cin >> length;
  int numbers[length];
  for (int i = 0; i < length; i++) {
    cin >> numbers[i];
    int sum = numbers[i];
    if (sum == 0) count++;
    for (int k = i + 1; k < length; k++) {
      sum += numbers[k];
      if (sum == 0) count++;
    }
    sum = 0;
  }
  cout << count << endl;
  return 0;
}
