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