import math
a = int(input())
b = int(input())
dist = abs(b-a)
total = 0
posa = posb = 0
while posa+posb != dist:
    posa += 1
    total += posa
    if posa+posb == dist: break
    posb += 1
    total += posb
print(total)


