#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, cou;
  cou = 0;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  for (int i = 0; i < N - 1; i++) {
    int a = 0;
    for (int j = i; j < N; j++) {
      a += A[j];
      if (a == 0) cou++;
    }
  }
  cout << cou << endl;
}
