import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;

public class Task1 {


    FastScanner in;



    public void solve() {
        int first = in.nextInt();
        int second = in.nextInt();
        int tirednessFirst = 1;
        int tirednessSecond = 1;
        int sumTired = 0;
        if (first > second) {
            int t = second;
            second = first;
            first = t;
        }
        while (first!=second) {
            first++;
            sumTired += tirednessFirst;
            tirednessFirst++;
            if (first == second) {
                break;
            }
            second--;
            sumTired += tirednessSecond;
            tirednessSecond++;

        }
        System.out.println(sumTired);
    }
    public void run() {
        in = new FastScanner();
        solve();

    }
    class Pair {
        int min;
        int max;

        Pair(int a, int b) {
            min = a;
            max = b;
        }
        Pair(Pair a) {
            min = a.min;
            max = a.max;
        }
        public String toString () {
            return min + " " + max;
        }
    }
    class FastScanner {

        BufferedReader br;
        StringTokenizer st;
        String str;
        FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {


                try {
                    str = br.readLine();
                    if (str == null) {
                        return "";
                    }
                    else {
                        st = new StringTokenizer(str);
                    }
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }
    }


    public static void main(String[] args)
    {
        new Task1().run();
    }
}