#include <bits/stdc++.h>
using namespace std;
int a[300000];
int s[400000];
int main(void) {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  s[0] = a[0];
  for (int i = 0; i < n; i++) s[i + 1] = s[i] + a[i + 1];
  sort(s, s + n);
  int res = 0;
  for (int i = 0; i < n - 1; i++)
    if (s[i] == s[i + 1]) res++;
  printf("%d\n", res);
}
