#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000000000000000001;
struct edge {
  int to, cost;
};
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
struct Road {
  double cost;
  int a, b;
};
long long a[200001], c[200001] = {};
int main() {
  long long n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i + 1];
    c[i + 1] = c[i];
    c[i + 1] += a[i + 1];
  }
  long long total = 0;
  for (int i = 1; i < n + 1; i++) {
    for (int j = i + 1; j < n + 1; j++) {
      if (c[j] - c[i - 1] == 0) total++;
    }
  }
  cout << total << endl;
  return 0;
}
