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