def readInts():
    return map(long, raw_input().split())
def readInt():
    return long(raw_input())
import collections
a,b = readInt(), readInt()
a,b = min(a,b), max(a,b)
count = 0
s = 1
while a != b:
    if a != b:
        a+=1
        count += s
    if a != b:
        b-=1
        count += s
    s+=1

print count
#for i in xrange(n):
