#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long N, M, O, P = 0, c = 0, c2 = 0, crash = 0, nowtab = 1;
  double D, D2;
  char C;
  string S, T;
  vector<long long> v(0);
  cin >> N;
  vector<long long> A(N);
  for (long long i = 0; i < N; i++) cin >> A[i];
  for (long long i = 0; i < N; i++) {
    for (long long j = i; j < N; j++) {
      c += A[j];
      if (c == 0) c2++;
    }
    c = 0;
  }
  cout << c2 << endl;
}
