#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b[500000], c, g = 0;
  cin >> a;
  for (int n = 0; n < a; n++) {
    cin >> b[n];
  }
  for (int n = 0; n < a; n++) {
    c = 0;
    for (int m = n; m < a; m++) {
      c += b[m];
      if (c == 0) g++;
    }
  }
  cout << g << '\n';
  return (0);
}
