#include <bits/stdc++.h>
using namespace std;
bool check(int mid, int n, int m) {
  int x = (n + m) / 2;
  n = abs(x - n);
  m = abs(x - m);
  x = (n * (n + 1)) / 2 + (m * (m + 1)) / 2;
  if (mid >= x) return true;
  return false;
}
int bs(int n, int m) {
  int l = 0, h = 1000000000, mid = 0, ans;
  while (l <= h) {
    mid = l + (h - l) / 2;
    if (check(mid, n, m)) {
      ans = mid;
      h = mid - 1;
    } else
      l = mid + 1;
  }
  return ans;
}
int main() {
  int n, m;
  cin >> n >> m;
  int ans = bs(n, m);
  cout << ans << endl;
  return 0;
}
