fa = int(input())
fb = int(input())

mid = (fa+fb)//2

cntA = abs(fa-mid)
cntB = abs(fb-mid)

cnt = 1
suA = 0
for i in range(cntA):
    suA+=cnt
    cnt+=1
cnt = 1
sub = 0
for i in range(cntB):
    sub+=cnt
    cnt+=1

print(suA+sub)
