a, b = map(int, input().split())

try:
    print(min(a, b, int((len(bin(max(a, b))) - 3) * "1", 2)))
except:
    print(0)