#include <bits/stdc++.h>
using namespace std;
constexpr int N = 2e5;
int a[N];
int s[N + 1];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  s[0] = 0;
  int count = 0;
  for (int j = 1; j <= n; j++) {
    s[j] = a[j - 1] + s[j - 1];
    for (int i = j - 1; i >= 0; i--) {
      if ((s[j] - s[i]) == 0) count++;
    }
  }
  cout << count << endl;
  return 0;
}
