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