#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  scanf("%d%d", &a, &b);
  int has = b - a;
  int toten = 0, en = 1;
  if (has < 0) has *= -1;
  bool flag = false;
  if (has % 2 == 0) flag = true;
  while (has > 0) {
    has /= 2;
    if (has == 1 && flag == true) {
      toten += en + en;
      has = 0;
    } else if (has == 0) {
      toten += en;
      has = 0;
    } else {
      toten += en + en;
      en++;
    }
  }
  printf("%d\n", toten);
  return 0;
}
