a,b = map(int,input().split()) a,b = min(a,b) , max(a,b) if len(bin(a)) != len(bin(b)): print(a) else: i = len(bin(a)) - 2 print(pow(2,i-1)-1)