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