#include <bits/stdc++.h>
int a[200001];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  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) ++ans;
    }
  }
  if (ans)
    printf("%d\n", ans);
  else
    puts("");
  return 0;
}
