A,B = map(int, input().split()) if len(format(A, 'b'))==len(format(B, 'b')): print(2**(len(format(A, 'b'))-1)-1) else: print(min(A,B))