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