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