
import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
 *
 * @author sanjanadas
 */
public final class DistanceProblem {
    public static void main(String[] args) throws Exception{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int first = Integer.parseInt(br.readLine());
        int second = Integer.parseInt(br.readLine());
        int temp=0;
        if(first>second){
            temp = first;
            first = second;
            second = temp;
        }
        int midpoint;
        int sum = 0;
        double ans = Math.ceil((second-first)/2.0);
        midpoint = (int) ans;
        for(int i=first+1;i<=first+ans;i++){
            sum += i-first;
        }
        for(int i=second-1;i>second-ans;i--){
            sum += second - i;
        }
        System.out.println(sum);
    }
}
