# -*- coding: utf-8 -*-
# http://codeforces.com/contest/931/problem/A

def problem():
    
    in1 = int(input())
    in2 = int(input())

#    in1 = 10
#    in2 = 3
       
    moves = abs(in2 - in1)

    each = moves // 2
    
    cost = each * (each + 1) + (moves % 2 * (each + 1))
        
    return cost

    
print(problem())
#problem()