import java.util.Scanner;

public class FriendsMeeting {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();

		int b = sc.nextInt();
		int total = 0;
		
		if (a >= 1 && a <= 1000 || b <= 1000 && b >= 1 ) {
			
			if((a - b) >= 0 && ((a - b) % 2) == 0) {
				for (int i = 0; i <= (a-b)/2; i++) {
					total = (total + i)*2;
				}
				System.out.println(total);				
			}
			
			else if ((a - b) >= 0 && ((a - b) % 2 ) != 0) {
				for (int i = 0; i <= (a-b-1)/2; i++) {
					total = (total + i)*2;
				}
				System.out.println(total+1);				
			}
			
			else if((a - b) <= 0 && ((a- b) % 2) == 0) {
					for (int i = 0; i <= (a-b)/2; i++) {
						total = (total + i)*2;
					}
					System.out.println(total);					
			}
			
			else if ((a - b) <= 0 && ((b - a) % 2 ) != 0) {
					for (int i = 0; i <= (b - a -1)/2; i++) {
						total = (total + i)*2;
					}
					System.out.println(total+1);
			}			
		}		
	}

}
