#include <bits/stdc++.h>
using namespace std;
int main() {
  int A, P;
  cin >> A >> P;
  int x = 3 * A + P;
  int count = 0;
  while (x % 2 == 0) {
    x = x / 2;
    count++;
  }
  cout << count << endl;
}
