/* package codechef; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
    long MOD = 1000000007L;
    int INF = 1000000000;
    
    public class Obj implements Comparable<Obj>{
        public int start;
        public int end;
        
        public Obj(int start_, int end_){
            this.start = start_;
            this.end = end_;

        }
        
        public int compareTo(Obj other){
            if (other.start == this.start){
                return this.end - other.end;
            }
            return this.start - other.start;
        }

    }
    
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
        Codechef cf = new Codechef();
        cf.Solve();
	}
	
	public void Solve(){
        MyScanner sc = new MyScanner();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int l = Math.min(a, b);
        int r = Math.max(a, b);
        int total = 0;
        int k1 = 1;
        int k2 = 1;
        int z = 0;
        while (l < r){
            if (z == 0){
                total += k1;
                k1++;
                l++;
            }else{
                total += k2;
                k2++;
                r--;
            }
            z = 1 - z;
        }
        System.out.println(total);
	}
	
	//-----------PrintWriter for faster output---------------------------------
   public static PrintWriter out;
      
   //-----------MyScanner class for faster input----------
   public static class MyScanner {
      BufferedReader br;
      StringTokenizer st;
 
      public MyScanner() {
         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;
      }

   }
}
