#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];
  }
  int b[200010];
  b[0] = a[0];
  for (int i = 1; i < n; i++) b[i] = b[i - 1] + a[i];
  for (int i = 0; i < n; i++)
    if (b[i] == 0) ans++;
  for (int begin = 1; begin < n; begin++) {
    for (int fin = begin; fin < n; fin++) {
      if (b[fin] - b[begin - 1] == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
