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