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