ll n,i=1;{rd(n);for(;n-=__builtin_popcount(i+=2)%3==1;);(n=i>>-(-30..0))>1&&cout<<3+n%2*2;}