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