a = int(input())
b = int(input())
diff = abs(a-b)
s = 0
if(diff<=2):
    print(diff)
else:
    for i in range(1,(diff//2+1)):
        s = s + i
    for i in range(1,(diff-(diff//2)+1)):
        s = s + i
    print(s)
