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