#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long A[200001];
  for (long long i = (long long)0; i < (long long)n; i++) cin >> A[i];
  long long count = 0;
  long long total = 0;
  for (long long i = (long long)0; i < (long long)n - 1; i++) {
    total = 0;
    for (long long j = (long long)i; j < (long long)n; j++) {
      total += A[j];
      if (total == 0) {
        count++;
      }
    }
  }
  cout << count << endl;
  ;
  return 0;
}
