
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Scanner;
import java.util.StringTokenizer;

/**
 *
 * @author MyPC
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        InputReader reader = new InputReader(System.in);

        int n = reader.nextInt();
        int m = reader.nextInt();
        double distance;
        distance = (double)(n + m)/2;
        
        distance = Math.round(distance);
        
        
        int a = 0;
        int b = 0;
        int a1 = 1;
        int b1 = 1;
        
        if ( n >= distance){
            while (n > distance){
                   a = a + a1;
                   a1++;
                   n--;
            }
        }
        else{
            while(n < distance){
                a = a + a1;
                a1++;
                n++;
            }
        }
        
        if ( m >= distance){
            while (m > distance){
                   b = b + b1;
                   b1++;
                   m--;
            }
        }
        else{
            while(m < distance){
                b = b + b1;
                b1++;
                m++;
            }
        }
        
        System.out.println(a + b);
    }

}

class InputReader {

    StringTokenizer tokenizer;
    BufferedReader reader;
    String token;
    String temp;

    public InputReader(InputStream stream) {
        tokenizer = null;
        reader = new BufferedReader(new InputStreamReader(stream));
    }

    public InputReader(FileInputStream stream) {
        tokenizer = null;
        reader = new BufferedReader(new InputStreamReader(stream));
    }

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

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                if (temp != null) {
                    tokenizer = new StringTokenizer(temp);
                    temp = null;
                } else {
                    tokenizer = new StringTokenizer(reader.readLine());
                }

            } catch (IOException e) {
            }
        }
        return tokenizer.nextToken();
    }

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

    public float nextFloat() {
        return Float.parseFloat(next());
    }

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

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