a = int(input())
b = int(input())
aF = 1
bF = 1
allF = 0
if b < a:
    a, b = b, a
while a != b:
    a += 1
    allF += aF 
    aF += 1
    if a != b:
        b -= 1
        allF += bF
        bF += 1
print(allF)