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