#include <bits/stdc++.h>
using namespace std;
int a, b, t, x = 1, y = 1, ans;
int main() {
  cin >> a >> b;
  t = abs(a - b);
  while (t > 0) {
    if (t > 0) {
      ans += x, t -= 1, x++;
    }
    if (t > 0) {
      ans += y, t -= 1, y++;
    }
  }
  cout << ans << endl;
  return 0;
}
