#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, A[200001], cnt = 0;
  scanf("%d", &n);
  A[0] = 0;
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &A[i]);
    A[i] += A[i - 1];
  }
  sort(A, A + n + 1);
  for (long long i = 0; i < n; i++) {
    for (long long j = i + 1; j <= n; j++) {
      if (A[i] == A[j]) {
        cnt++;
      } else {
        break;
      }
    }
  }
  printf("%d\n", cnt);
  return 0;
}
