import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import java.util.Map.Entry;

public class Template {

    long MODULO = 1L * 1000 * 1000 * 1000 * 1000 * 1000 ;
    long b = 31;
    String fileName = "";
    void solve() throws IOException {
        int a = readInt();
        int b = readInt();
        if(a>b){
            int v = a;
            a = b;
            b = v;
        }
        long ans = 0;
        int cur = 1;
        while(a < b){
            a++;
            ans+=cur;
            if(a<b){
                a++;
                ans+=cur;
            }
            cur++;
        }
        out.println(ans);
    }

    boolean isLower(char c){
        return c >= 'a' && c <= 'z';
    }

    ////////////////////////////////////////////////////////////
    class Pair{
        int num;
        int val;
        Pair(int num, int val ){
            this.num = num;
            this.val = val;
        }
    }
    /*
    class SegmentTree {
        int start = 0;
        int end = 0;
        long delta;
        int n;
        long result;
        long[] t;
        boolean[] lazy;
        int[] length;
        Pair[] segments;
        SegmentTree(int n, int[] a){
            this.n = n;
            t = new long[4*n];
            lazy = new boolean[4*n];
            length = new int[4*n];
            segments = new Pair[4*n];
            build(a, 1, 1, n);
        }

        void build(int[] a, int v, int tl, int tr){
            if(tl>tr) return;
            if(tl == tr){
                t[v] = a[tl];
                length[v] = 1;
                return;
            }
            int mid = (tl+tr)/2;
            build(a, 2*v, tl, mid);
            build(a, 2*v+1, mid+1, tr);
            length[v] = tr - tl +1;
            t[v] = t[2*v] + t[2*v+1];
        }
        void pushVertex(int v, int vLeft, int vRight){
            lazy[vLeft] += lazy[v];
            lazy[vRight] += lazy[v];
            lazy[v] = 0;
        }

        void updateVertex(int v, int vLeft, int vRight){
            t[v] = getSum(vLeft) + getSum(vRight);
        }

        long getSum(int v){
            return t[v] + lazy[v] * length[v];
        }

        void incSegment(int start, int end, long delta){
            this.start = start;
            this.end = end;
            this.delta = delta;
            incSegment(1, 1, n);
        }

        void incSegment(int v, int l, int r){
            if(start <= l && r <= end){
                lazy[v] += delta;
            }else{
                int mid = (r+l)/2;
                int vLeft = (v << 1);
                int vRight = vLeft + 1;
                pushVertex(v, vLeft, vRight);

                if(start <= mid) incSegment(vLeft, l, mid);
                if(end >= mid +1) incSegment(vRight, mid+1, r);

                updateVertex(v, vLeft, vRight);
            }
        }

        long getSegment(int start, int end){
            this.start = start;
            this.end = end;
            this.result = 0;
            getSegment(1, 1, n);
            return result;
        }
        void getSegment(int v, int l, int r){
            if(start <= l && r <= end){
                result += getSum(v);
            }else{
                int mid = (r+l)/2;
                int vLeft = (v << 1);
                int vRight = vLeft + 1;
                pushVertex(v, vLeft, vRight);

                if(start <= mid) getSegment(vLeft, l, mid);
                if(end >= mid +1) getSegment(vRight, mid+1, r);

                updateVertex(v, vLeft, vRight);
            }
        }
    }
*/
    class Fenwik {
        long[] t;
        int length;

        Fenwik(int[] a) {
            length = a.length + 100;
            t = new long[length];

            for (int i = 0; i < a.length; ++i) {
                inc(i, a[i]);
            }
        }

        void inc(int ind, int delta) {
            for (; ind < length; ind = ind | (ind + 1)) {
                t[ind] += delta;
            }
        }

        long getSum(int r) {
            long sum = 0;
            for (; r >= 0; r = (r & (r + 1)) - 1) {
                sum += t[r];
            }
            return sum;
        }
    }
    int gcd(int a, int b){
        return b == 0 ? a : gcd(b, a%b);
    }

    long binPow(long a, long b, long m) {
        if (b == 0) {
            return 1;
        }
        if (b % 2 == 1) {
            return ((a % m) * (binPow(a, b - 1, m) % m)) % m;
        } else {
            long c = binPow(a, b / 2, m);
            return (c * c) % m;
        }

    }

    public static void main(String[] args) throws NumberFormatException, IOException {
        // TODO Auto-generated method stub
        new Template().run();
    }

    void run() throws NumberFormatException, IOException {
        solve();
        out.close();
    };

    BufferedReader in;
    PrintWriter out;

    StringTokenizer tok;
    String delim = " ";
    Random rnd = new Random();

    Template() throws FileNotFoundException {
        try {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        } catch (Exception e) {
            if (fileName.isEmpty()) {
                in = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            } else {
                in = new BufferedReader(new FileReader(fileName + ".in"));
                out = new PrintWriter(fileName + ".out");
            }

        }
        tok = new StringTokenizer("");
    }

    String readLine() throws IOException {
        return in.readLine();
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            String nextLine = readLine();
            if (null == nextLine) {
                return null;
            }

            tok = new StringTokenizer(nextLine);
        }
        return tok.nextToken();
    }

    int readInt() throws NumberFormatException, IOException {
        return Integer.parseInt(readString());
    }
    byte readByte() throws NumberFormatException, IOException {
        return Byte.parseByte(readString());
    }
    int[] readIntArray (int n) throws NumberFormatException, IOException {
        int[] a = new int[n];
        for(int i=0; i<n; ++i){
            a[i] = readInt();
        }
        return a;
    }
    long readLong() throws NumberFormatException, IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws NumberFormatException, IOException {
        return Double.parseDouble(readString());
    }
}