a = int(input())
b = int(input())
x, j = 0, 0
if abs(b-a) % 2 == 0:
    for i in range(1, (abs(b-a)//2)+1):
        x += i
    print(2*x)
else:
    for j in range((abs(b-a)//2)+1):
        x += j
    print((2*x)+j+1)