#include <bits/stdc++.h>
const int maxn = (int)2e5 + 5;
const int inf = 0x3f3f3f3f;
const int mod = (int)1e9 + 9;
using namespace std;
int a[maxn];
long long sum[maxn];
int main() {
  int n;
  scanf("%d", &n);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    sum[i] = sum[i - 1] + a[i];
    if (sum[i] == 0) ans++;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (sum[j] - sum[i] == 0) ans++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
