#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  int A[N + 1];
  A[0] = 0;
  for (int i = 0; i < N; ++i) {
    cin >> A[i + 1];
    A[i + 1] += A[i];
  }
  int answer = 0;
  for (int i = 0; i <= N; ++i) {
    for (int j = i + 1; j <= N; ++j) {
      if (A[j + 1] - A[i] == 0) ++answer;
    }
  }
  cout << answer << endl;
}
