#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, ans, res1, res2;
  cin >> a >> b;
  ans = (abs(a - b) / 2) + 1;
  if (ans < 3) {
    cout << ans << endl;
  } else {
    res1 = (ans * (ans + 1)) / 2;
    res2 = (abs(a - b)) - ans;
    res2 = (res2 * (res2 + 1)) / 2;
    cout << res1 + res2;
  }
  return 0;
}
