import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.StringTokenizer;
import javafx.util.converter.BigIntegerStringConverter;
import java.util.*;

/**
 *
 * @author Ahmad
 */
public class JavaApplication1 {

    
    public static void main (String[] args) throws IOException, Exception {
      FastReader console = new FastReader();
      int a = console.nextInt() ; 
      int b = console.nextInt() ; 
      int count1 = 1 ; 
      int count2 = 1 ; 
      int sum = 0 ;
      if (a>b){
      while (a!=b){
          a-- ;
          sum+=count1 ; 
          count1 ++ ; 
          if (a==b){
              break ; 
          }
          else {
              b++ ;
              sum+=count2 ;
              count2 ++ ; 
          }
      }
          System.out.println(sum);
     }
     else if (b>a){
        while (a!=b){
          a++ ;
          sum+=count1 ; 
          count1 ++ ; 
          if (a==b){
              break ; 
          }
          else {
              b-- ;
              sum+=count2 ;
              count2 ++ ; 
          }
        }
          System.out.println(sum);
      }
   }
}
class Sorting{
   
 public static int[] bucketSort(int[] array, int bucketCount) {

 if (bucketCount <= 0) throw new IllegalArgumentException("Invalid bucket count");

 if (array.length <= 1) return array; //trivially sorted

 

 int high = array[0];

 int low = array[0];

 for (int i = 1; i < array.length; i++) { //find the range of input elements

 if (array[i] > high) high = array[i];

 if (array[i] < low) low = array[i];

 }

 double interval = ((double)(high - low + 1))/bucketCount; //range of one bucket
 

 ArrayList<Integer> buckets[] = new ArrayList[bucketCount];

 for (int i = 0; i < bucketCount; i++) { //initialize buckets

 buckets[i] = new ArrayList();

 }

 

 for (int i = 0; i < array.length; i++) { //partition the input array
    
 buckets[(int)((array[i] - low)/interval)].add(array[i]);

 }
 

 int pointer = 0;

 for (int i = 0; i < buckets.length; i++) {

 Collections.sort(buckets[i]); //mergeSort

 for (int j = 0; j < buckets[i].size(); j++) { //merge the buckets

 array[pointer] = buckets[i].get(j);

 pointer++;

 }

}

return array;

}

}

class FastReader {

    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
        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;
    }
}
