#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  int count = 0;
  for (int i = 0; i < n; i++) {
    long x = 0;
    for (int j = i; j < n; j++) {
      x += a.at(j);
      if (x == 0) count++;
    }
  }
  cout << count << endl;
}
