import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.Arrays;


/** Class for buffered reading int and double values */


public class codeforces1{
    public static void main (String[] args) throws IOException
    {
        Reader.init(System.in);
        int a = Reader.nextInt();
        int b = Reader.nextInt();
        int mid = (a+b+1)/2;
        int a1= 0,b1 = 0;
        if(a<b)
        {
            a1 = mid -a;
            b1 = b - mid;
        }
        else{
            a1 =a - mid;
            b1 = mid - b;
        }

        int sum = (a1*(a1+1))/2 + (b1*(b1+1))/2;

        System.out.println(sum);
    }
}
class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                    reader.readLine() );
        }
        return tokenizer.nextToken();
    }

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

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