#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
inline int pt(int a[], int l, int r) {
  int p, i, j;
  p = a[l];
  i = l;
  j = r + 1;
  for (;;) {
    while (a[++i] < p)
      if (i >= r) break;
    while (a[--j] > p)
      if (j <= l) break;
    if (i >= j)
      break;
    else
      swap(a[i], a[j]);
  }
  if (j == l) return j;
  swap(a[l], a[j]);
  return j;
}
inline void q_sort(int a[], int l, int r) {
  int q;
  if (r > l) {
    q = pt(a, l, r);
    q_sort(a, l, q - 1);
    q_sort(a, q + 1, r);
  }
}
inline int readint() {
  int x = 0;
  int f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') ch = getchar();
  if (ch == '-') {
    f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int a[100005];
int n;
int main() {
  int i, j;
  cin >> n;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = 2; i <= n; i++) a[i] += a[i - 1];
  long long ans = 0;
  for (i = 1; i <= n; i++) {
    for (j = i; j <= n; j++) {
      if (a[j] - a[i - 1] == 0) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
