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