#include <bits/stdc++.h>
using namespace std;
int main() {
  long n, a[300000], c, ans;
  ans = 0;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; i++) {
    c = 0;
    for (long long j = i; j < n; j++) {
      c += a[j];
      if (c == 0) ans++;
    }
  }
  printf("%ld", ans);
}
