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