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