#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long int a[123456];
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int c;
  c = 0;
  long long int sum;
  for (int i = 0; i < n; ++i) {
    sum = 0;
    for (int j = i; j < n; ++j) {
      sum += a[j];
      if (sum == 0) {
        c++;
      }
    }
  }
  cout << c;
}
