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