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