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