import java.util.*;

public class gffh {
	public static void main(String[] args) {
		Scanner scanny = new Scanner(System.in);
		int x = scanny.nextInt();
		int y = scanny.nextInt();
		int mid = (x+y)/2;
		int t = 0;
		int min = Math.min(x, y);
		int max = Math.max(x, y);
		while(min<mid) {
			int add = 1;
			min++;
			t+=add;
			add++;
		}
		while(max>mid) {
			int add = 1;
			max--;
			t+=add;
			add++;
		}
		System.out.println(t);
	}
}