#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, reiwa, ans = 0;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < n; ++i) {
    reiwa = 0;
    for (int j = i; j < n; ++j) {
      reiwa += a[j];
      if (reiwa == 0) {
        ans++;
      }
    }
  }
  cout << ans << '\n';
}
