#include <bits/stdc++.h>
using namespace std;
int arr[100000];
int main() {
  int N, ans = 0;
  cin >> N;
  for (int i = 0; i < N; i++) cin >> arr[i];
  for (int i = 0; i < N; i++) {
    int sum = 0;
    for (int j = i; j < N; j++) {
      sum += arr[j];
      if (sum == 0) {
        ans++;
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
