#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int ans = 0;
  int count;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    count = 0;
    while (count + i < n) {
      sum = 0;
      for (int j = i; j < n - count; j++) {
        sum += a[j];
      }
      if (sum == 0) ans++;
      count++;
    }
  }
  cout << ans << endl;
  return 0;
}
