#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, cnt = 0;
  cin >> n;
  vector<int> val(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &val[i]);
  }
  for (int i = 1; i < n; i++) {
    val[i] += val[i - 1];
  }
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      int t;
      if (i == 0)
        t = val[j];
      else
        t = val[j] - val[i - 1];
      if (t == 0) cnt++;
    }
  }
  cout << cnt;
  return 0;
}
