#include<math.h>
n,t,r;
float S;
main(i){
	for(;scanf("%d",&n),n;i=-i){
		r=360;
		for(;--n;){
			scanf("%d",&t);
			r-=t;
			S+=sin(t*M_PI/180)*i;
		}
		S+=sin(r*M_PI/180)*i;
		if(i<0){
			puts(fabs(S)>1e-6?S>0?"1":"2":"0");
			S=0;
		}
	}
	exit(0);
}