#include using namespace std; using ll = long long; int main(void) { ll N, K; cin >> N >> K; int ans = 0; int c = 0; ll R = N - K; while (R || K) { int a = R & 1; int b = K & 1; if (a + b + c >= 2) { ans += 1; c = 1; } else { c = 0; } R >>= 1; K >>= 1; } cout << ans << endl; return 0; }