#include <bits/stdc++.h>
using namespace std;
int a[200005];
int n;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  int i, j;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    long long sum = 0;
    for (int j = i; j <= n; j++) {
      sum += a[j];
      if (sum == 0) {
        ans++;
        sum = 0;
        continue;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
