#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  cin >> N;
  int A[N];
  for (int i = 0; i < N; i++) cin >> A[i];
  int B[N + 1];
  B[0] = 0;
  for (int i = 1; i < N + 1; i++) {
    B[i] = B[i - 1] + A[i - 1];
  }
  int count = 0;
  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;
}
