/*
 * Remember a 7.0 student can know more than a 10.0 student.
 * Grades don't determine intelligence, they test obedience. 
 * I Never Give Up.
 */
import java.util.*;
import java.io.*;
 
//import javafx.util.Pair;
import static java.lang.System.out;
import static java.util.Arrays.*;
import static java.lang.Math.*;
public class ContestMain {
	private static Reader in=new Reader();
	private static StringBuilder ans=new StringBuilder();
	private static long MOD=1000000007;//10^9+7 
	private static final int N=10000000;
//	private static final double PI=3.1415;
//	private static ArrayList<Integer> v[];
//	private static int color[]=new int[N]; //For Graph Coloring
//	private static boolean mark[];
//	private static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
//	private static void dfs(int node){mark[node]=true;for(int x:v[node]){if(!mark[x]){dfs(x);}}}
	private static long powmod(long x,long n,long m){
		if(n==0)return 1;
		else if(n%2==0)return(powmod((x*x)%m,n/2,m));
		else return (x*(powmod((x*x)%m,(n-1)/2,m)))%m;
	}
	public static void solve(long ar[],int n,long h){
		
	}
	public static void main(String[] args) throws IOException{
		int a=in.nextInt();
		int b=in.nextInt();
		int nex1=1,nex2=1;
		int total=0;
		while(a!=b){
			if(a>b){
				a--;
				total+=nex1;
				nex1++;
			if(a==b)break;
			else{
				b++;
				total+=nex2;
				nex2++;
			}
		   }
		  else{
				b--;
				total+=nex2;
				nex2++;
				if(b==a)break;
				else{
					a++;
					total+=nex1;
					nex1++;
				}
			}
		}
		out.println(total);
	}
	static class Reader{
        BufferedReader br;
        StringTokenizer st;
 
        public Reader()
        {
            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;
        }
    }
}   