#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  if (a > b) swap(a, b);
  int pred_a = 0, pred_b = 0;
  int ans = 0;
  int ch = 0;
  while (a < b) {
    if (ch == 0) {
      pred_a++;
      ans += pred_a;
      ch = 1;
      a++;
    } else {
      pred_b++;
      ans += pred_b;
      ch = 0;
      b--;
    }
  }
  cout << ans;
}
