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