#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[i];
  }
  int count = 0;
  for (int i = 0; i < n; ++i) {
    int isum = 0;
    for (int j = i; j < n; ++j) {
      isum += a[j];
      if (isum == 0) {
        count++;
      }
    }
  }
  cout << count;
}
