#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = (int)(0); i < (int)(n); ++i) cin >> a[i];
  int sum, cnt = 0;
  for (int i = (int)(0); i < (int)(n); ++i) {
    sum = 0;
    for (int j = (int)(i); j < (int)(n); ++j) {
      sum += a[j];
      if (sum == 0) {
        cnt++;
        break;
      }
    }
  }
  cout << cnt << endl;
}
