#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 100;
long long a[maxn];
long long f[maxn];
int main() {
  int N;
  scanf("%d", &N);
  long long ans = 0;
  scanf("%lld", &a[0]);
  f[0] = a[0];
  for (int i = 1; i < N; i++) {
    scanf("%lld", &a[i]);
    f[i] = f[i - 1] + a[i];
  }
  for (int i = 0; i < N; i++) {
    for (int j = i; j < N; j++) {
      if ((f[j] - f[i] + a[i]) == 0) ans++;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
