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