#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long a, b;
  long long cont = 0;
  long long res = 10000005;
  cin >> a >> b;
  vector<long long> v1;
  vector<long long> v2;
  v1.push_back(0);
  v2.push_back(0);
  long long maior = max(a, b);
  long long menor = min(a, b);
  long long dist = maior - menor;
  cont = 0;
  for (long long i = 1; i <= dist; i++) {
    cont += i;
    v1.push_back(cont);
  }
  v2 = v1;
  sort(v2.begin(), v2.end(), greater<long long>());
  for (long long i = 0; i <= dist; i++) {
    res = min(res, v2[i] + v1[i]);
  }
  cout << res << endl;
}
