#include <bits/stdc++.h>
using namespace std;
long int S[100001];
long int arr[100001];
int main() {
  int N, ans = 0;
  cin >> N;
  for (int i = 1; i <= N; i++) cin >> arr[i];
  S[0] = 0;
  for (int i = 1; i <= N + 1; i++) S[i] = S[i - 1] + arr[i];
  sort(S, S + N + 1);
  for (int i = 1, t = S[0]; i <= N; i++) {
    if (t == S[i]) ans++;
    t = S[i];
  }
  cout << ans << endl;
  return 0;
}
