#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
const int MAXN = 2e5 + 10;
int n;
long long a[MAXN], sum[MAXN];
int main() {
  scanf("%d", &n);
  for (int i = (0); i < (int)(n); ++i) {
    scanf("%lld", a + i);
    if (i == 0)
      sum[i] = 0;
    else
      sum[i] = sum[i - 1];
    sum[i] += a[i];
  }
  sort(sum, sum + n);
  int cnt = 0;
  int j = 0;
  int sj = 0;
  for (int i = (0); i < (int)(n); ++i) {
    if (sum[i] == 0) cnt++;
    j = sj;
    while (j < i) {
      if (sum[j] != sum[i])
        sj = j + 1;
      else
        cnt++;
      j++;
    }
  }
  printf("%d\n", cnt);
  return 0;
}
