#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  int langkahA, langkahB = 0;
  int total = 0;
  bool giliranA = true;
  cin >> a >> b;
  if (a < b) {
    int t = a;
    a = b;
    b = t;
  }
  while (a != b) {
    if (giliranA) {
      a--;
      langkahA++;
      total += langkahA;
    } else {
      b++;
      langkahB++;
      total += langkahB;
    }
    giliranA = !giliranA;
  }
  cout << total << endl;
  return 0;
}
