#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, cnt = 0, nnum = 0, fg = 0;
  cin >> N;
  int A[N];
  for (int lop = 0; lop < N; lop++) {
    cin >> A[lop];
  }
  for (int lop = 1; lop < N + 1; lop++) {
    for (int lop2 = 0; lop2 < lop; lop2++) {
      for (int lop3 = lop2; lop3 < lop; lop3++) {
        nnum += A[lop3];
      }
      if (nnum == 0) {
        cnt++;
      }
    }
  }
  cout << cnt << "\n";
  return 0;
}
