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