#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 B[100000];
int main() {
  int count = 0;
  cin >> n;
  for (long long i = (0); i < (n); ++i) {
    int a;
    cin >> a;
    A[i] = a;
    B[i] = a;
    if (i > 0) {
      for (long long j = (i - 1); j >= (0); --j) {
        B[i] += A[j];
        if (B[i] == 0) {
          count++;
        }
      }
    }
  }
  cout << (count) << endl;
  return 0;
}
