#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  long long a[200000];
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  int ans = 0;
  long long sum[2000000001];
  long long rui = 0;
  for (int i = 0; i < n; ++i) {
    rui += a[i];
    sum[rui + 1000000000]++;
  }
  for (int i = 0; i < 2000000001; ++i) {
    ans += sum[i] / 2;
  }
  cout << ans << endl;
}
