#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
long long nums[200009];
long long m;
int main() {
  int n;
  int ans = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &m);
    for (int j = i; j >= 0; j--) {
      nums[j] += m;
      if (nums[j] == 0) {
        ans++;
      }
    }
  }
  printf("%d", ans);
  return 0;
}
