a = int(input())
b = int(input())
meetingPoint = (a+b)//2
moves1 = moves2 = 0
if a < b:
    while a != meetingPoint:
        a += 1
        moves1 += 1
    while b != meetingPoint:
        b -= 1
        moves2 += 1
else:
    while a != meetingPoint:
        a -= 1
        moves1 += 1
    while b != meetingPoint:
        b += 1
        moves2 += 1 
print(moves1*(moves1+1)//2 + moves2*(moves2+1)//2)