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