#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  scanf("%d", &N);
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%d", &A[i]);
  }
  int sum;
  int result = 0;
  for (int i = 0; i < N; i++) {
    sum = A[i];
    for (int j = i + 1; j < N; j++) {
      sum += A[j];
      if (sum == 0) {
        result += 1;
      }
    }
  }
  printf("%d", result);
  return 0;
}
