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