import java.util.*;
import java.math.*;
import java.io.*;

public class CF931A {
	public CF931A(FastScanner scan, PrintWriter out) {
		int a = scan.nextInt(), b = scan.nextInt();
		if(a > b) {
			int tmp = a;
			a = b;
			b = tmp;
		}
		int res = 0;
		int A = 1, B = 1;
		for(int i = 0 ; i < 10000 && a != b; i++) {
			if(i % 2 == 0) {
				a++;
				res += A;
				A++;
			} else {
				b--;
				res += B;
				B++;
			}
		}
		System.out.println(res);
	}

	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			try {
				br = new BufferedReader(new InputStreamReader(System.in));
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				e.printStackTrace();
			}
		}

		public String next() {
			if (st.hasMoreTokens())
				return st.nextToken();
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				e.printStackTrace();
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public String nextLine() {
			String line = "";
			if (st.hasMoreTokens())
				line = st.nextToken();
			else
				try {
					return br.readLine();
				} catch (IOException e) {
					e.printStackTrace();
				}
			while (st.hasMoreTokens())
				line += " " + st.nextToken();
			return line;
		}
	}

	public static void main(String[] args) {
		FastScanner scan = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		new CF931A(scan, out);
		out.close();
	}
}
