#include <bits/stdc++.h>
using namespace std;
int data[200005], pref[200005];
int main() {
  int n;
  long long sum = 0;
  int ban = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &data[i]);
    sum += data[i];
    pref[i + 1] = sum;
    if (sum == 0) ban++;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j < i; j++) {
      if (pref[i] - pref[j] == 0) ban++;
    }
  }
  cout << ban << endl;
  return 0;
}
