a,b = map(int,input().split())
if a > b:
  a,b = b,a
p,q = a.bit_length(),b.bit_length()
if p == q:
  print((1<<p-1)-1)
else:
  print(a)