a = int(input())
b = int(input())

point = int(a/b)

tired = 0

i = 1
j = 1

while a != b:
    if a < b:
        if i < j:
            a += 1
            tired += i
            i += 1
        else:
            b -= 1
            tired += j
            j += 1
    else:
        if i < j:
            a -= 1
            tired += i
            i += 1
        else:
            b += 1
            tired += j
            j += 1
print(tired)
