#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y, mul = 1, sum = 0, diff;
  cin >> x, y;
  if (x > y) {
    diff = x - y;
    if (diff < 3)
      cout << diff;
    else {
      while (diff > 0) {
        sum = sum + mul * (diff % 2);
        mul++;
        diff = diff / 2;
      }
      cout << sum;
    }
  } else {
    diff = y - x;
    if (diff < 3)
      cout << diff;
    else {
      while (diff > 0) {
        sum = sum + mul * (diff % 2);
        mul++;
        diff = diff / 2;
      }
      cout << sum;
    }
  }
  return 0;
}
