#include <bits/stdc++.h>
using namespace std;
long long n, a[200005], x, y;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      x += a[j];
      if (x == 0) y++;
    }
    x = 0;
  }
  cout << y;
  return 0;
}
