#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n + 10];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int total = 0;
    for (int k = 0; k < n - i; k++) {
      total += a[i + k];
      if (total == 0) {
        ans += 1;
      }
    }
  }
  cout << ans << endl;
}
