def SumToN(n):
    return (n*(n+1))/2

def FrndsMeet():
    a = int(raw_input())
    b = int(raw_input())
    min_cor = min(a,b)
    max_cor = max(a,b)

    if (max_cor-min_cor)%2 == 0:
        meet_point = (min_cor)+((max_cor-min_cor)/2)
    else:
        meet_point = (min_cor) + ((max_cor-min_cor)/2)+1

    
    tiredness = SumToN(meet_point-min_cor)+SumToN(max_cor-meet_point)
    print tiredness

FrndsMeet()
