#include <bits/stdc++.h>
using namespace std;
using VI = vector<int>;
using VVI = vector<VI>;
using VS = vector<string>;
using PII = pair<int, int>;
using LL = long long;
const int INF = 1 << 29;
const double EPS = 1e-10;
const double PI = acos(-1.0);
int main() {
  int N;
  int ans = 0;
  cin >> N;
  VI A(N);
  for (int i = 0; i < (N); i++) cin >> A[i];
  for (int i = (1); i < (N + 1); i++) {
    for (int j = 0; j < (N - i + 1); j++) {
      long long int sum = 0;
      for (int k = 0; k < (i); k++) sum += A[j + k];
      if (sum == 0) ans += 1;
    }
  }
  cout << ans << endl;
  return 0;
}
