inf = 10**18 a,b = map(int, input().split()) if a>b: a,b = b,a ans = inf for i in range(a+1): for j in range(a+1): ans = min(ans, abs((i+j) - ((b-i)+(a-j)))) print(ans)