#include <bits/stdc++.h>
using namespace std;
int a[200100];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int cnt = 0;
  int SM = 0;
  int x;
  for (int i = 2; i <= n; i++)
    for (int j = 1; j <= n - i + 1; j++) {
      x = j;
      for (int k = 1; k <= i; k++) SM += a[j++];
      if (SM == 0) cnt++;
      SM = 0;
      j = x;
    }
  cout << cnt << endl;
  return 0;
}
