first=int(input())
second=int(input())
subtract=abs(first-second)
if subtract==1:
    print("1")
else:
    count=0
    k=subtract
    for i in range(1,k):
        subtract=subtract-1
        count=count+i
        if subtract != 0:
            subtract=subtract-1
            count=count+i 
        else:
            break
    print(count)
        