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