A=[[[3,0],[1,2]],[[0,3],[1,2]],[[0,3],[2,1]]] B=list(map(ord,"01>?;=24<6937:58")) N=int(input()) def f(n,x,y): if n%2:return (x+y-n//2)%n*n+(y-x+n//2)%n if n<5:return B[x*4+y]-48 n//=2 return f(n,x//2,y//2)*4+A[(y|1