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