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