#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>

using namespace std;

static inline long long folds(unsigned long long x, unsigned long long lim){
    
    long long cnt = 0;
    while (x > lim){
        x = (x+1)/2;
        ++cnt;
    }
    return cnt;
}


int main()
{
    unsigned long long n,m,h,w;
    if (!(cin>>n >>m >>h >> w)) return 0;
    
    unsigned long long f1 = folds(n,h) + folds(m,w);
    unsigned long long f2 = folds(n,w) + folds(m,h);
    
    cout << min(f1,f2) << "\n";
    return 0;
}