#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, dis, ai = 0, bi = 0, sum = 0;
  cin >> a >> b;
  dis = abs(a - b);
  while (dis > 0) {
    if (ai <= bi) {
      ai++;
      sum += ai;
      dis--;
    } else {
      bi++;
      sum += bi;
      dis--;
    }
  }
  cout << sum;
  return 0;
}
