#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, count = 0;
  cin >> n;
  long long num[n];
  for (int i = 0; i < n; i++) {
    cin >> num[i];
  }
  int i = 0;
  while (i < n) {
    int sum = 0;
    for (int x = i; x < n; x++) {
      sum += num[x];
      if (sum == 0) count++;
    }
    i++;
  }
  cout << count << endl;
}
