#Codeforces Problem 931A
a=int(input())
b=int(input())
tmn=0
tmx=0
cmx=0
cmn=0
if(a>b):
    max=a
    min=b
else:
    max=b
    min=a
if(a==b):
    t=0
else:
    while True:
        max-=1
        cmx+=1
        tmx+=cmx
        if(max==min):
            t=tmx+tmn
            break
        min+=1
        cmn+=1
        tmn+=cmn
        if(max==min):
            t=tmx+tmn
            break
print(t)