#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;
const long long INFLL = 1001001001001001001LL;
template <typename T>
void chmin(T& a, T b) {
  if (a > b) a = b;
}
template <typename T>
void chmax(T& a, T b) {
  if (a < b) a = b;
}
int main() {
  int N;
  scanf("%d", &N);
  vector<long long> A;
  for (int i = 0; i < N; i++) {
    long long tmp;
    scanf("%d", &tmp);
    A.push_back(tmp);
  }
  long long ans = 0;
  int* lookup;
  lookup = new int[N];
  for (int i = 0; i < N; ++i) {
    lookup[i] = 0;
  }
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j <= i; ++j) {
      lookup[j] += A[i];
      if (lookup[j] == 0) {
        ++ans;
      }
    }
  }
  printf("%lld", ans);
  delete (lookup);
  return 0;
}
