#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> accum(N + 1, 0);
  for (long long i = 0; i < (long long)N; i++) {
    cin >> A[i];
    accum[i + 1] = accum[i] + A[i];
  }
  long long ans = 0;
  for (int left = 0; left < N; left++) {
    for (int right = left + 1; right < N + 1; right++) {
      if (accum[right] - accum[left] == 0) {
        ans++;
      }
    }
  }
  cout << ans << endl;
}
