a = int(input())
b = int(input())

result = 0
contA = 0
contB = 0
while(a != b):
    if(contA > contB):
        if(b > a):
            b -= 1
        else:
            b += 1
        contB += 1
        result += contB
    else:
        if(a < b):
            a += 1
        else:
            a -= 1
        contA += 1
        result += contA
print(result)