coord1 = int(raw_input())
coord2 = int(raw_input())
tired = 0
diff = coord1 - coord2
if diff < 0:
    diff = coord2 - coord1

if diff == 1:
    print 1
elif diff == 2:
    print 2
else:
    for i in range(1,(diff/2)+1):
        tired =tired + (2*i)
    if(diff % 2 ==1):
        tired += i+1
    print tired