#include <bits/stdc++.h>
using namespace std;
int main() {
  int N[200001];
  int A[100000];
  int n, c = 0;
  int a = 0;
  int d = 0;
  bool b = false;
  bool f = false;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> N[i];
  }
  for (int i = 0; i < n; i++) {
    a = 0;
    b = false;
    f = false;
    for (int k = 1; k < d; k++)
      if (i == A[k]) f = true;
    if (f == true)
      continue;
    else {
      for (int j = i; j < n; j++) {
        a += N[j];
        if (a == 0) {
          c++;
          b = true;
        }
        if (b == true && j < n) {
          a = 0;
          b = false;
          A[d] = j;
          d++;
        }
      }
    }
  }
  cout << c;
  return 0;
}
