import sys
import math
import bisect

def main():
    a = int(input())
    b = int(input())
    d1 = abs(a - b) // 2
    d2 = (abs(a - b) + 1) // 2
    ans = 0
    for i in range(1, d1 + 1):
        ans += i
    for i in range(1, d2 + 1):
        ans += i
    print(ans)

if __name__ == "__main__":
    main()
