#include<bits/stdc++.h>
using namespace std;
namespace IO
{
	const int buffer_size=1e5+5;
	char buf[buffer_size],*S,*T;
	bool flag_EOF;
	inline char read_char()
	{
	    if(S==T)
			T=(S=buf)+fread(buf,1,buffer_size,stdin);
	    return S!=T?*(S++):EOF;
	}
	inline int read_int()
	{
	    int flag=1;
	    char c=read_char();
	    while(c<'0'||c>'9')
	    {
	        if(c==EOF)
	        {
	            flag_EOF=true;
	            return 0;
	        }
	        flag=(c=='-'?-1:1);
	        c=read_char();
	    }
	    int x=0;
	    while(c>='0'&&c<='9')
	    {
	        x=x*10+(c^48);
	        c=read_char();
	    }
	    return x*flag;
	}
	char st[13];
	int _top;
	void Write(int x)
	{
		if(!x)
		{
			putchar('0');
			return;
		}
		if(x<0)
		{
			putchar('-');
			x=-x;
		}
		while(x)
		{
			st[++_top]=x%10+'0';
			x/=10;
		}
		while(_top>0)
			putchar(st[_top--]);
	}
}
int main()
{
	long long x,y;
	cin>>x>>y;
	long long ans=1e18;
	for(int k=0;;++k)
	{
		if(k!=0)
			x<<=1;
		long long res=k;
		long long val=x>y?x-y:y-x;
		int now=k;
		while(1)
		{
			while(!(val&1)&&now>0)
				val>>=1,--now;
			if(now==0)
			{
				res+=val;
				break;
			}
			int i=0;
			while(val&(1ll<<i))
				++i;
			i=min(i,now);
			if(i==1)
				++res,val^=1;
			else
			{
				res+=2;
				val^=(1ll<<i)-1;
			}
		}
		ans=min(ans,res);
		if(x>=y)
			break;
	}
	printf("%lld\n",ans);
	return 0;
}

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
long long int mod = 1e9+7;

int main(){
	int a,b;
	cin>>a>>b;
	cout<<2*a+100-b<<endl;
	return 0;
}