#include <bits/stdc++.h>
using namespace std;
int main() {
  long long x1, x2, z, p = 0, y = 0, k = 1, m = 1;
  cin >> x1 >> x2;
  z = (x1 + x2) / 2;
  x1 = min(x1, x2);
  x2 = (2 * z - x1);
  for (long long i = x1; i <= z; i++) {
    p = p + k;
    k++;
  }
  for (long long j = x2; j > z; j--) {
    y = y + m;
    m++;
  }
  cout << y + p;
  return 0;
}
