ll@n,@k;
k=n*(n+1)/2-k;
ll l=0,r=0;
while(r<=n){
	while(k<0){
		k+=++l;
	}
	if(k==0){
		wt(1);
		exit(0);
	}
	k-=++r;
}
wt(2);