#include <bits/stdc++.h>
using namespace std;
int a[100000];
int main() {
  int c, b, res;
  cin >> c;
  cout << endl;
  cin >> b;
  for (int i = 1; i < 99999; i++) {
    a[i] = i;
  }
  for (long long int i = 1; i < 99; i++) {
    a[i] = a[i] + a[i - 1];
  }
  long long int di = (c - b);
  if (di < 0) di = -di;
  if (di % 2 == 0)
    res = 2 * a[di / 2];
  else
    res = a[di / 2] + a[(di / 2) + 1];
  cout << res;
  return 0;
}
