#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10;
long long ar[MAXN];
int n;
int main() {
  ios::sync_with_stdio(false);
  while (cin >> n) {
    ar[0] = 0;
    long long tmp = 0;
    for (int i = 1; i <= n; i++) {
      cin >> tmp;
      ar[i] = tmp + ar[i - 1];
    }
    long long cnt = 0;
    for (int i = 2; i <= n; i++) {
      for (int j = 1; j <= i; j++) {
        if (ar[i] - ar[j - 1] == 0) cnt++;
      }
    }
    cout << cnt << endl;
  }
  return 0;
}
