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

public class FastInput {

    public static PrintWriter out;

    public static void main(String[] args) {
        MyScanner sc = new MyScanner();

        out = new PrintWriter(new BufferedOutputStream(System.out));

        int s1 = sc.nextInt();
        int s2 = sc.nextInt();

        int fp = (s1+s2)/2;
        int cost = 1, ans = 0;
        while(s1!=fp) {
            ans += cost++;

            if (s1 < fp) {
                s1++;
            } else {
                s1--;
            }
        }
        cost = 1;
        while(s2 != fp) {
            ans += cost++;

            if (s2 < fp) {
                s2++;
            } else {
                s2--;
            }
        }

        out.println(ans);


        // Start writing your solution here. -------------------------------------

          /*
          int n      = sc.nextInt();        // read input as integer
          long k     = sc.nextLong();       // read input as long
          double d   = sc.nextDouble();     // read input as double
          String str = sc.next();           // read input as String
          String s   = sc.nextLine();       // read whole line as String

          int result = 3*n;
          out.println(result);                    // print via PrintWriter
          */

        // Stop writing your solution here. -------------------------------------
        out.close();
    }

    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

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

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

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

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

        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
}
