A,B = map(int, input().split()) ba = bin(A)[2:] bb = bin(B)[2:] ka = len(ba) kb = len(bb) if ka==kb: print((1<<(ka-1))-1) else: print(min(A,B))