#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(signed i=0;i<n;++i)
#define int long long
#define str string
#define vint vector<signed>
#define pint pair<signed,signed>
#define pb(a) push_back(a)
#define all(v) v.begin(),v.end()
#define yn(b) cout<<((b)?"Yes":"No")<<endl
#define YN(b) cout<<((b)?"YES":"NO")<<endl
#define isEven(t) t%2==0

signed main(){
  int n;
  cin>>n;
  int a[n];
  rep(i,n)cin>>a[i];
  int res=0;
  int sum[n+1]={0};
  for(int i=1;i<=n+1;++i)sum[i]=sum[i-1]+a[i-1];
  sort(sum,sum+n+1);
  rep(i,n)if(sum[i]==sum[i+1])res++;
  //rep(i,n+1)cout<<sum[i]<<" ";cout<<endl;
  cout<<res;
  return 0;
}
