#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
int main() {
  int a[200000] = {}, tmp, n, counter = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &tmp);
    for (int j = 0; j < i + 1; j++) {
      a[j] += tmp;
      if (!a[j]) {
        counter++;
      }
    }
  }
  printf("%d\n", counter);
}
