import java.util.ArrayList;
import java.util.Scanner;

public class Problem1 {

    static Scanner scanner = new Scanner(System.in);

    static String line;

    private static void nextLine() {
        line = scanner.nextLine();
    }

    private static String getLine() {
        return line;
    }

    private static ArrayList<Double> getLineDoubles() {

        String[] parts = line.split(" ");

        ArrayList<Double> res = new ArrayList<>(parts.length);

        for (String part : parts) {

            res.add(Double.valueOf(part.trim()));
        }

        return res;
    }

    private static ArrayList<Float> getLineFloats() {

        String[] parts = line.split(" ");

        ArrayList<Float> res = new ArrayList<>(parts.length);

        for (String part : parts) {

            res.add(Float.valueOf(part.trim()));
        }

        return res;
    }

    private static ArrayList<Integer> getLineInts() {

        String[] parts = line.split(" ");

        ArrayList<Integer> res = new ArrayList<>(parts.length);

        for (String part : parts) {

            res.add(Integer.valueOf(part.trim()));
        }

        return res;
    }

    private static ArrayList<Long> getLineLongs() {

        String[] parts = line.split(" ");

        ArrayList<Long> res = new ArrayList<>(parts.length);

        for (String part : parts) {

            res.add(Long.valueOf(part.trim()));
        }

        return res;
    }

    private static ArrayList<String> getLineStrings() {

        String[] parts = line.split(" ");

        ArrayList<String> res = new ArrayList<>(parts.length);

        for (String part : parts) {

            res.add(part.trim());
        }

        return res;
    }


    ///////////////////////////////////////////

    public static void main(String[] args) {
        nextLine();
        int a = getLineInts().get(0);
        nextLine();
        int b = getLineInts().get(0);

        int dif = Math.abs(a-b);

        int n = dif/2;
        int res = 0;

        if (n > 1) {
            res += ((1 + n)*n)/2;
        }

        if (n == 1) {
            res += 1;
        }

        res *= 2;


        if (dif%2 == 1) {
            res += n+1;
        }


        System.out.println(res);
    }


}
