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