#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
int DX[] = {1, 1, 0, -1, -1, -1, 0, 1};
int DY[] = {0, -1, -1, -1, 0, 1, 1, 1};
void solve() {
  int n;
  cin >> n;
  ll a[n];
  for (int(i) = 0; (i) < (n); (i)++) cin >> a[i];
  ll x[n][n];
  ll res = 0;
  for (int i = 0; i < n; i++) {
    x[i][i] = a[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      x[i][j] = x[i][j - 1] + a[j];
      if (x[i][j] == 0) res++;
    }
  }
  cout << res << endl;
}
int main() {
  solve();
  return 0;
}
