#include <bits/stdc++.h>
using namespace std;
const int mxn = 2e5 + 10;
int a[mxn];
int suma[mxn];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) suma[i] = suma[i - 1] + a[i];
  long long cnt = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < i; j++) {
      if (suma[i] - suma[j] == 0) cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}
