#include <bits/stdc++.h>
using namespace std;
int main() {
  int longs, zerosum = 0;
  cin >> longs;
  vector<int> numbers(longs);
  for (int i = 0; i < longs; i++) {
    cin >> numbers.at(i);
  }
  for (int i = 0; i < longs; i++) {
    int sum = 0;
    for (int j = 0; j < longs - i; j++) {
      sum += numbers.at(i + j);
      if (sum == 0) zerosum++;
    }
  }
  cout << zerosum << endl;
}
