#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
inline int readint() {
  long long 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;
}
long long 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]) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
