#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
int main() {
  int N;
  int cnt = 0;
  cin >> N;
  vector<ll> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N - i; j++) {
      if (accumulate(A.begin() + i, A.end() - j, 0) == 0) cnt++;
    }
  }
  cout << cnt;
}
