#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  int sum = 0;
  int ans = 0;
  int l;
  for (int j = 0; j < n; j++) {
    for (int k = 0; k <= j; k++) {
      sum = 0;
      l = k;
      while (k <= l && l <= j) {
        sum += a.at(l);
        l++;
      }
      if (sum == 0) {
        ans += 1;
      }
    }
  }
  cout << ans << endl;
}
