#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const int Max = 1e9 + 10;
int s[N];
int a[N];
int main() {
  int n;
  scanf("%d", &n);
  memset(a, (0), sizeof(a));
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  memset(s, (0), sizeof(s));
  long long sum = 0;
  long long c = 0;
  for (int i = 1; i <= n; i++) {
    s[i] += a[i] + s[i - 1];
  }
  for (int i = n; i >= 1; i--) {
    for (int j = 0; j < i; j++) {
      if (s[i] - s[j] == 0) c++;
    }
  }
  printf("%d\n", c);
}
