# -*- coding: utf-8 -*-
"""
A
"""

def calculate_tiredness(start, end):
    distance = abs(end-start)
    return int(distance*(distance+1)/2)

def main():
    a = int(input())
    b = int(input())
    middle = (a+b)//2
    print(calculate_tiredness(a, middle) + calculate_tiredness(b, middle))

if __name__ == "__main__":
    main()