#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, sum, ans;
  cin >> n;
  vector<int> vec(n);
  for (int i = 0; i < n; i++) cin >> vec.at(i);
  for (int j = 0; j < n; j++) {
    for (int h = j; h < n; h++) {
      sum += vec.at(h);
      if (sum == 0) {
        ans += 1;
        break;
      }
      if (h == n - 1) sum = 0;
    }
  }
  cout << ans << endl;
}
