A,B=map(int,input().split()) x=A.bit_length() y=B.bit_length() if x!=y: print(min(A,B)) else: print((1<<(x-1))-1)