#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n + 10];
  int x[n + 10];
  int total;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    total += a[i];
    x[i] = total;
    if (x[i] == 0) ans += 1;
  }
  int pre = 0;
  for (int i = 1; i < n; i++) {
    for (int k = i; k < n; k++) {
      x[k] -= pre;
      if (x[k] == 0) {
        ans += 1;
      }
    }
    int pre = a[i];
  }
  cout << ans << endl;
}
