#include <bits/stdc++.h>
using namespace std;
long long const DIM = 1000002;
long long n, i, j, c, sum;
long long a[DIM];
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (i = 1; i <= n; i++) {
    for (j = i; j <= n; j++) {
      sum += a[j];
      if (sum == 0) c++;
    }
    sum = 0;
  }
  cout << c << endl;
  return 0;
}
