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