n = int(input())
m = int(input())
sub = abs(n-m)
div = round(sub/2)
cnt = 0
if sub == 1:
    for i in range(1,sub+1):
        cnt += i
else:
    for i in range(1,div+1):
        cnt += i
    for j in range(1,(sub-div)+1):
        cnt += j
print(cnt)
