import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;
 
public class apples {
	static ArrayList<Integer> [] arr;
	static boolean[]vis;
	
	public static void main(String[] args) throws IOException {
		Scanner zizo=new Scanner(System.in);
		PrintWriter wr = new PrintWriter(System.out);
		
		int a=zizo.nextInt();
		int b=zizo.nextInt();
		int s=Math.abs(a-b);
		
		
		int i=1;
		int r=0;
		//System.out.println(s);
		while(s!=0) {
			if(s==1) {
				r+=i;
				s--;
			}
			else {
				r+=i*2;
				s-=2;
			}
			//System.out.println(r+" "+s);
			i++;
		}
		
		
		
		
		
		
		System.out.println(r);
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
	}
	static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(InputStream s){  br = new BufferedReader(new InputStreamReader(s));}

        public String next() throws IOException 
        {
            while (st == null || !st.hasMoreTokens()) 
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        public int nextInt() throws IOException {return Integer.parseInt(next());}
        
        public long nextLong() throws IOException {return Long.parseLong(next());}
        public double nextDouble() throws IOException {return Double.parseDouble(next());}

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

        public boolean ready() throws IOException {return br.ready();}


    }
}