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