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