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