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