#include <bits/stdc++.h>
using namespace std;
int a[200100];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  int cnt = 0;
  int SM = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      SM += a[j];
      if (SM == 0) cnt++;
    }
    SM = 0;
  }
  cout << cnt << endl;
  return 0;
}
