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