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