#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  int n = 0;
  cin >> n;
  vector<long> arr;
  arr.clear();
  for (int i = 0; i < n; i++) {
    long temp;
    cin >> temp;
    arr.push_back(temp);
  }
  long result = 0;
  for (int i = 0; i < n - 1; i++) {
    long number = 0;
    for (int j = i; j < n; j++) {
      number += arr[j];
      if (number == 0) {
        result++;
      }
    }
  }
  cout << result << endl;
  return 0;
}
