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