#include <bits/stdc++.h>
using namespace std;
static const int INF = 1e+9 + 7;
long long n, m;
string s, t;
int A[100000];
int main() {
  cin >> n;
  for (long long i = (0); i < (n); ++i) cin >> A[i];
  int count = 0;
  for (long long i = (0); i < (n); ++i) {
    for (long long j = (i + 1); j < (n); ++j) {
      A[i] += A[j];
      if (A[i] == 0) count++;
    }
  }
  cout << (count) << endl;
  return 0;
}
