xor-game

Given two integers, LL and RR, find the maximal value of AA xor BB, where AA and BB satisfy the following condition:

L≤A≤B≤RL≤A≤B≤R

Input Format

The input contains two lines; LL is present in the first line and RR in the second line.

Constraints
1≤L≤R≤101≤L≤R≤103

Output Format

The maximal value as mentioned in the problem statement.

SAMPLE INPUT
1
10

SAMPLE OUTPUT
15

Explanation

The input tells us that L=10L=10 and R=15R=15. All the pairs which comply to above condition are the following:
10⊕10=010⊕10=0
10⊕11=110⊕11=1
10⊕12=610⊕12=6
10⊕13=710⊕13=7
10⊕14=410⊕14=4
10⊕15=510⊕15=5
11⊕11=011⊕11=0
11⊕12=711⊕12=7
11⊕13=611⊕13=6
11⊕14=511⊕14=5
11⊕15=411⊕15=4
12⊕12=012⊕12=0
12⊕13=112⊕13=1
12⊕14=212⊕14=2
12⊕15=312⊕15=3
13⊕13=013⊕13=0
13⊕14=313⊕14=3
13⊕15=213⊕15=2
14⊕14=014⊕14=0
14⊕15=114⊕15=1
15⊕15=015⊕15=0
Here two pairs (10, 13) and (11, 12) have maximum xor value 7, and this is the answer

Source: hackerearth | Difficulty: EASY


Solutions:
'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
def mm(l,r):
	q=l^r
	a=1
	while q>0:
		q=q/2
		a=a*2
	return a-1

l=int(input())
r=int(input())
print((mm(l,r)))


import math
def range_xor_max(small, high):
	if small == high:
		return 0
	xor = small ^ high
	#how many power of 2 is present
	how_many_power_of_2 = math.log(xor, 2)
	#we need to make all one's below the highest set bit
	return 2**int(math.floor(how_many_power_of_2)+1) - 1
x=eval(input(""))
y=eval(input(""))
print(range_xor_max(x,y))


import math
def range_xor_max(small, high):
	if small == high:
		return 0
	xor = small ^ high
	#how many power of 2 is present
	how_many_power_of_2 = math.log(xor, 2)
	#we need to make all one's below the highest set bit
	return 2**int(math.floor(how_many_power_of_2)+1) - 1
x=eval(input(""))
y=eval(input(""))
print(range_xor_max(x,y))


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
def mm(l,r):
	q=l^r
	a=1
	while q>0:
		q=q/2
		a=a*2
	return a-1

l=int(input())
r=int(input())
print((mm(l,r)))