#include <bits/stdc++.h>
using namespace std;
int main() {
  int size = 0, count = 0;
  cin >> size;
  int* array = new int[size];
  for (int i = 0; i < size; i++) {
    cin >> array[i];
  }
  for (int i = 0; i < size - 1; i++) {
    int n = array[i];
    for (int j = i + 1; j < size; j++) {
      n += array[j];
      if (n == 0) {
        count++;
        n = 0;
      }
    }
  }
  cout << count << endl;
  return 0;
}
