import java.util.Scanner;

public class FrendsMeeting {
    /*931A*/
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("1st friend: ");
        int a = in.nextInt();
        System.out.println("2nd friend: ");
        int b = in.nextInt();
        int sum=0;

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

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

        }else
            System.out.println("error");
    }
}
