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