#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 sum = A[i];
    if (A[i] == 0) count++;
    for (int j = i + 1; j < N; j++) {
      sum += A[j];
      if (sum == 0) count++;
    }
  }
  cout << count << endl;
  return 0;
}
