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