#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i = 0, sum = 0, counter = 0;
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  int a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      sum += a[j];
      if (sum == 0) {
        counter += 1;
      }
    }
    sum = 0;
  }
  cout << counter << endl;
}
