first = int(raw_input())
second = int(raw_input())
mid = (first+second)/2

if second < first:
    first, second = second, first

ans = 0
sum = 0
step = 0
while first < mid:
    first += 1
    step += 1
    sum += step 

step = 0

while mid < second:
    second -= 1
    step += 1
    sum += step

print sum