#include <bits/stdc++.h>
using namespace std;
const long MAX_N = 2 * 1e5;
int main() {
  int N;
  long A[MAX_N];
  long r[MAX_N];
  long sum = 0;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    if (i)
      r[i] = r[i - 1] + A[i];
    else
      r[i] = A[i];
    if (!r[i]) sum++;
  }
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      r[j] -= A[i];
      if (!r[j]) sum++;
    }
  }
  cout << sum << endl;
}
