#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N = 0;
  cin >> N;
  int *A, *S;
  A = (int *)malloc((N + 1) * sizeof(int));
  int sum = 0;
  int flag = 0;
  A[0] = 0;
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
    A[i] += A[i - 1];
  }
  sort(A, A + N + 1);
  for (int y = 0; y <= N; y++) {
    for (int x = y + 1; x <= N + 1; x++) {
      if (A[x] == A[y]) {
        flag++;
      }
    }
  }
  cout << flag << endl;
  free(A);
  return 0;
}
