a, b = map(int, input().split()) x = a.bit_length() y = b.bit_length() if x == y: print(pow(2, x - 1) - 1) else: print(min(a, b))