#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  int sum;
  int count;
  cin >> N;
  int A[200010];
  int x[200010];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    x[i] = 1;
  }
  count = 0;
  for (int i = 0; i < N; i++) {
    sum = 0;
    for (int j = i; j < N; j++) {
      sum += A[j];
      if (sum == 0) {
        count += x[i];
        x[j + 1] += x[i];
        break;
      }
    }
  }
  cout << count << endl;
}
