import java.io.*;
import java.util.StringTokenizer;

public class R468A {

    FastScanner sc;
    PrintWriter out;


    int a;
    int b;

    // res -> Определите минимальную суммарную усталость друзей при условии,
    // что они должны оказаться в одной точке.

    private void solve() {
        a = sc.nextInt();
        b = sc.nextInt();

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

        if (diff == 1) {
            out.println(1);
            return;
        }

        if (diff%2==0) {
            int x = diff/2;
            int sum = 0;
            for(int i=1; i<=x; i++) {
                sum += i;
            }
            out.println(sum*2);
        } else {
            int x = diff/2;
            int y = diff - x;
            int sum = 0;
            for (int i=1; i<=x; i++) {
                sum += i;
            }
            for (int i=1; i<=y; i++) {
                sum +=i;
            }

            out.println(sum);
        }
    }



    private void run() {
        // sc = new FastScanner(new File("input.txt"));
        sc  = new FastScanner(System.in);
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

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

    private class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

        boolean hasMoreTokens() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return false;
                st = new StringTokenizer(s);
            }
            return true;
        }

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

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}
