#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 30;
int main() {
  int a[200010], n, ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int begin = 0; begin < n; begin++) {
    for (int fin = begin; fin < n; fin++) {
      int sum = 0;
      for (int i = begin; i <= fin; i++) {
        sum += a[i];
      }
      if (sum == 0) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
