if __name__ == "__main__":
    a = int(input())
    b = int(input())
    diff = abs(a - b)
    half_diff = diff // 2
    if half_diff % 2 == 0:
        tiredness = 2 * (half_diff + 1) * half_diff // 2
    elif half_diff == 1:
        tiredness = 2
    else:
        tiredness = 2 * (half_diff + 1) * half_diff // 2 + (half_diff + 1) // 2
    if diff % 2 == 1:
        tiredness += half_diff + 1
    print(tiredness)