import java.math.BigInteger;
import java.util.*;
import java.io.*;
public class A{
    public static void main(String arg[]) {
        FastScanner sc = new FastScanner(System.in);
            int a = sc.nextInt();
            int b = sc.nextInt();
            int ab = (a+b)/2;
            a = Math.abs(a-ab);
            b = Math.abs(b-ab);
        System.out.println((a*(a+1)/2)+(b*(b+1)/2));
    }


















            public static long f(long u ){
      return  u == 1?  1 :  u *f(u-1);
            }
    public int bi(long []x,int str,int end,long looking){
        int o = (str+end)/2;
        if(x[o]>looking){
            for(int i =str;i<o;++i){
                if(x[i]>=looking){
                    return i;
                }
            }
        }
        else if (x[o]<looking){
            for(int i =o;i<end;++i){
                if(x[i]>=looking){
                    return i;
                }
            }
        }
        return o;
    }




    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream stream) {
            try {
                br = new BufferedReader(new InputStreamReader(stream));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.valueOf(next());
        }
        double nextd() {
            return Double.valueOf(next());
        }
    }
}