#include <bits/stdc++.h>
using namespace std;
int n, a[200005], s[200005], ans;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    s[i] = s[i - 1] + a[i];
  }
  if (n == 1 && a[1] == 0)
    cout << 1;
  else if (n == 1 && a[1] != 0)
    cout << 0;
  else {
    for (int i = 2; i <= n; i++)
      for (int j = 0; j < i; j++)
        if (s[i] - s[j] == 0) ans++;
    cout << ans;
  }
}
