#include <bits/stdc++.h>
using namespace std;
long long B[200001];
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  int ans = 0;
  for (int i = 0; i < N - 1; i++) {
    B[i] = A.at(i);
    for (int j = i + 1; j < N; j++) {
      B[j] = B[j - 1] + A.at(j);
      if (B[j] == 0) ans++;
    }
  }
  cout << ans << endl;
}
