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