#include<bits/stdc++.h> using namespace std; int fun(int a,double s,double e){ if(a==-1||s<e) return -1; int ans=0; while(s>e) ans++,s/=2; return ans+a; } int main(){ double w,h,w1,h1,ans; cin>>w>>h>>w1>>h1; int a1=0; a1=fun(a1,w,w1); a1=fun(a1,h,h1); int a2=0; a2=fun(a2,w,h1); a2=fun(a2,h,w1); if(a1==-1||a2==-1){ if(a1==-1) ans=a2; if(a2==-1) ans=a1; }else{ ans=min(a1,a2); } cout<<ans; return 0; }