#include <bits/stdc++.h>
using namespace std;
long long sum[200005], ans = 0;
int a[200005], n, i, j;
int main(void) {
  cin >> n;
  scanf("%d", &a[i]);
  sum[1] = a[1];
  for (i = 2; i <= n; i++) {
    scanf("%d", &a[i]);
    sum[i] += sum[i - 1] + a[i];
  }
  for (i = 1; i <= n; i++) {
    if (sum[i] == 0) ans++;
    for (j = i + 1; j <= n; j++) {
      if (sum[j] == sum[i]) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
