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