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