//package com.company;

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

public class Main {
    public static void main(String[] args) throws IOException {
        MyScanner sc = new MyScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        Tanks.solve(sc, pw);
        pw.close();
    }
    public static class Tanks {


        public static void solve(MyScanner sc, PrintWriter pw) throws IOException {
            int a = sc.nextInt();
            int b = sc.nextInt();
            if(b < a) {
                int temp = a;
                a = b;
                b = temp;
            }
            int t1 = 0, t2 = 0;
            int sum = 0;
            while (b - a > 1) {
                b--;
                a++;
                t1++;t2++;
                sum+=t1;
                sum+=t2;
            }
            if (b - a == 1) {
                sum += (t1 + 1);
            }
            pw.println(sum);

        }

    }



    static class MyScanner {
        StringTokenizer st;
        BufferedReader br;

        public MyScanner(InputStream s){  br = new BufferedReader(new InputStreamReader(s));}

        public MyScanner(FileReader s) throws FileNotFoundException {br = new BufferedReader(s);}

        public String next() throws IOException
        {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

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

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

        public String nextLine() throws IOException {return br.readLine();}

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

        public boolean ready() throws IOException {return br.ready();}
    }
}
