__author__ = 'RaldenProg'

x1 = int(input())
x2 = int(input())
y1 = 0
y2 = 0
z1 = 0
z2 = 0
while x1 != x2:
    if x1 < x2:
        x1 += 1
        y1 += 1
        z1 += y1
        if x1 < x2:
            x2 -= 1
            y2 -= 1
            z2 -= y2
    if x2 < x1:
        x2 += 1
        y2 += 1
        z2 += y2
        if x2 < x1:
            x1 -= 1
            y1 -= 1
            z1 -= y1
print(z1+z2)