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