a = int(input())
b = int(input())
d = abs(a-b)

def dis(x):
    h = 0
    for i in range(1, x+1):
        h += i

    return h    

if d % 2 == 0:
    print(dis(d//2)*2)
else:
    print(dis(d//2)+dis(d - d//2))
