#!/usr/bin/python3
# Встреча друзей, сложность - 800
x1 = int(input())
x2 = int(input())
t = 0; k = 1
fatigue1 = 0; fatigue2 = 0
delta = x2 - x1 if x2 > x1 else x1 - x2
while delta > 0:
   if t % 2 == 0:
      fatigue1 = fatigue1 + k
   else:
      fatigue2 = fatigue2 + k
      k = k + 1
   t = t + 1; delta = delta - 1
print(fatigue1 + fatigue2)
