#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
const int N = 1e6 + 10;
int a[N];
int main() {
  memset((a), (0), sizeof(a));
  int sum = 0;
  for (int i = 1; i <= 1000; i++) {
    sum += i;
    int o = sum;
    while (o > 0 && a[o] == 0) a[o] = sum, o -= 2;
  }
  int x, y;
  cin >> x >> y;
  x = abs(x - y);
  int ans = INF;
  for (int i = x; i <= 20000; i++) ans = min(ans, a[i] + a[i - x]);
  for (int i = 0; i <= x; i++) ans = min(ans, a[i] + a[x - i]);
  cout << ans << endl;
  return 0;
}
