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