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