import math
if __name__ == '__main__' :
    a = int(input())
    b = int(input())
    c = 0
    if abs(a-b)%2 == 0 :
        for i in range(((a+b)//2)-min(a,b)) :
            c = c+i+1
        print(2*c)
    else :
        for i in range(abs(a-b)//2) :
            c = c+i+1
        print((2*c)+(abs(a-b)//2)+1)