#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < (int)(n); ++i) cin >> a[i];
  int ans = 0;
  long long sum[n + 1];
  sum[0] = 0;
  for (int i = (int)(1); i < (int)(n + 1); ++i) {
    sum[i] = sum[i - 1] + a[i - 1];
    if (sum[i] == 0) ans++;
  }
  for (int i = 0; i < (int)(n); ++i) {
    for (int j = 0; j < (int)(i); ++j) {
      if (sum[i] - sum[j] == 0) ans++;
    }
  }
  cout << ans << endl;
}
