def has_bit_zero(low, high, i): if low > high: return False mask = 1 << i max_zero = mask - 1 return low <= max_zero and high >= low def has_bit_one(low, high, i): if low > high: return False mask = 1 << i return high >= max(low, mask) def max_xor(low_x, high_x, low_y, high_y): if low_x > high_x or low_y > high_y: return -1 # No possible XOR result = 0 for i in reversed(range(32)): # Assuming 32-bit integers mask = 1 << i candidate = result | mask can_0_1 = has_bit_zero(low_x, high_x, i) and has_bit_one(low_y, high_y, i) can_1_0 = has_bit_one(low_x, high_x, i) and has_bit_zero(low_y, high_y, i) if can_0_1 or can_1_0: result = candidate return result A, B = map(int, input().split()) low = 0 high = min(A, B) ans = 0 while low <= high: mid = (low + high) // 2 x_low, x_high = mid, A y_low, y_high = mid, B mx = max_xor(x_low, x_high, y_low, y_high) if mx >= mid: ans = mid low = mid + 1 else: high = mid - 1 print(ans)