a[25000]={0,1},m=5e4,n,i,j,k,s=1;main(x){for(scanf("%d",&n);!a[n]&&s;x++){memcpy(a+m,a,m);for(s=i=0;i++n|a[i+j]||a[i+j+m]++|s++;i