#include <vector> 
#include <list> 
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <complex>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;

typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(t,c) for(typeof((c).begin()) t=(c).begin(); t!=(c).end(); ++t)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(t,a,b) for(int t=(a);t<(b);++t)
#define REP(t,n)  FOR(t,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << '=' << (x) << endl;
#define debug(x) cerr << #x << '=' << (x) << '('<<'L' << __LINE__ << ')' << ' ' << __FILE__ << endl;



const LL mod = 1000000007;

LL gcd(LL a, LL b) { if (a%b == 0) { return b; } else return gcd(b, a%b); }
LL lcm(LL a, LL b) { return a / gcd(a, b)*b; }

#define Yes_ cout<<"Yes"<<endl; return 0;
#define No_ cout<<"No"<<endl; return 0;


#define YES_ cout<<"YES"<<endl; return 0;
#define NO_ cout<<"NO"<<endl; return 0;

#define POSSIBLE cout<<"POSSIBLE"<<endl; return 0;
#define IMPOSSIBLE cout<<"IMPOSSIBLE"<<endl; return 0;

namespace UnionFind {
	const int MAX_N = 1010101;
	int par[MAX_N];//N番目のnodeの親nodeのindex
	int Rank[MAX_N];//木の深さ

	void init(int n) {
		REP(i, n) {
			par[i] = i;//rootの親は自分に設定しておくことでrootの判別ができる
			Rank[i] = 0;
		}
	}

	//xのrootを求める
	int find(int x) {
		//root
		if (par[x] == x) {
			return x;
		}
		else {
			return par[x] = find(par[x]);//ここで親を貼り直している
		}
	}

	//木の統合
	void unite(int x, int y) {
		//x = find(x), y = find(y);//親ノードの検出
		if (x == y) { return; }//何もしない

							   //併合の際に２つの木の高さが異なれば高さの小さいものが大きい物の根へと辺をはる
		if (Rank[x] < Rank[y]) {
			par[x] = y;
			//Rank[y]のほうが深いのでRankの更新は行わなくて良い
		}
		else {
			par[y] = x;
			//２つの根が同じ深さの場合は１つの根がもうひとつの根につくわけなので深さは1増える
			if (Rank[x] == Rank[y]) { Rank[x]++; }
		}
		/*if (vact[x] > vact[y]) {
			par[y] = x;
		}
		else {
			par[x] = y;
		}*/
	}

	bool same(int x, int y) {
		return find(x) == find(y);
	}
}


int main() {
	
	int a, b;
	cin >> a >> b;
	int d = abs(b - a);

	int l = (1 + (d - 1))*(d - 1) / 2;

	dump(l);
	cout << l - min(a, b) << endl;


}


Measured memory_bytes: 256