#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int A[N];
  for (int i = 0; i < N; i++) {
    int tmp;
    cin >> tmp;
    if (i == 0) {
      A[0] = tmp;
    } else {
      A[i] = A[i - 1] + tmp;
    }
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (A[i] == 0) {
      ans++;
    }
    for (int j = 0; j < i; j++) {
      if ((A[i] - A[j]) == 0) {
        ans++;
      }
    }
  }
  cout << ans << "\n";
  return 0;
}
