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