#include <bits/stdc++.h>
using namespace std;
const int Maxx = 2e5 + 7;
const int Inf = 1e9 + 7;
int n;
int a[Maxx];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  int cnt = 0;
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    sum = 0;
    sum += a[i];
    for (int j = i + 1; j <= n; j++) {
      sum += a[j];
      if (sum == 0) cnt++;
    }
  }
  printf("%d\n", cnt);
  return 0;
}
