#!/bin/python3

a = int(input())
b = int(input())

d = abs(a - b)
half = d // 2
miss = d % 2

tired = 0
for i in range(1, half+1+miss):
    tired += i
for i in range(1, half+1):
    tired += i

print(tired)
