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