import sys input=sys.stdin.readline T = [] A,B = map(int, input().split()) for i in range(A): for j in range(B): T.append(min(i,j,i^j)) print(max(T))