#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a;
  long long s[200001], ans = 0;
  s[0] = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a;
    s[i] += a + s[i - 1];
  }
  for (int right = 1; right <= n; right++) {
    for (int left = 0; left < right; left++) {
      if (s[right] - s[left] == 0) {
        ans += 1;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
