#include <bits/stdc++.h>
using namespace std;
int a[200001];
int b[200001];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  b[0] = a[0];
  int cnt = 0;
  for (int i = 1; i < n; i++) {
    b[i] = b[i - 1] + a[i];
    if (b[i] == 0) {
      cnt++;
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      b[j] -= a[i];
      if (b[j] == 0) {
        cnt++;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
