#include<iostream>
using namespace std;
#define debug(x) //printf(x);printf("\n");
int main(){
  int n;

  cin >> n;
  int *v = new int[n+1];
  v[0]=0;
  for(int i=1;i<n+1;i++){
    cin >> v[i] + v[i-1];
    debug("read val");
  }

  sort(v,v+n);
  int cnt = 0;
  int uniq = v[0];
  for(int i=1;i<n+1;i++){
    if( uniq == v[i] ){
      cnt++;
    }
    else{
      uniq=v[i];
    }
  }

  delete(v);
  cout << cnt; 
  return 0;
}