i,A=-1,a[14]={0,1,1,1,7,4,1,336,384,334,220,108,36,6},b[10]={108,220,334,384,334,220,108,36,6};main(){long long n;scanf("%lld",&n);if(n<14)A=a[n];else if(n==27||n==134217723)A=976;else if(n==29||n==536870907)A=4;else if(n==61||n==2305843009213693946)A=1;else if(n==1152921504606846970)A=220;else if(n==268435451)A=108;else for(i=0;i<9;i++)if(pow(2,i+5)-n==4)A=b[i];printf("%d",A);}