
import java.util.*;
import java.lang.*;
import java.util.regex.*;
import java.math.*;
import java.io.*;

public class Friends_Meeting {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int x = in.nextInt();
		int y = in.nextInt();
		int dist = Math.abs(x-y);
		int c = (int)Math.ceil((double)dist/2);
		int f = (int)Math.floor((double)dist/2);
		if(c == f){
			if(c == 1){
				System.out.println(sum(c) + sum(f));
			}else{
				System.out.println(sum(c));
			}			
		}else{
			System.out.println(sum(c) + sum(f));
		}

	}
	
	public static int sum(int x){
		return ((x)*(x+1))/2;
	}

}

