#include <bits/stdc++.h>
using namespace std;
int main(int argc, const char* argv[]) {
  long N;
  cin >> N;
  vector<long> As(N);
  for (long i = 0; i < N; i++) {
    cin >> As[i];
  }
  long ans = 0;
  for (long i = 0; i < N; i++) {
    for (long j = i; j < N; j++) {
      long sum = 0;
      for (long mitr = i; mitr <= j; mitr++) {
        sum += As[mitr];
      }
      if (sum == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
