#include <bits/stdc++.h>
using namespace std;
const int maxn = 250000 + 50;
long long num[maxn];
int cnt[maxn];
int main() {
  int n;
  scanf("%d", &n);
  long long summ = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &num[i]);
  }
  for (int i = 1; i <= n; i++) {
    long long kkk = num[i];
    if (kkk == 0) summ++;
    for (int j = i + 1; j <= n; j++) {
      kkk += num[j];
      if (kkk == 0) summ++;
    }
  }
  printf("%lld\n", summ);
  return 0;
}
