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