#include <bits/stdc++.h>
using namespace std;



int main(){

    int x;
    cin>>x;
    for(int i= 1; i<=1001; i++){
    	if(i*100  > x){
    		cout<<i*100-x;
    		break;
		}
	}


	return 0;
}


#include<bits/stdc++.h>
using namespace std;
# define ll long long
# define read read1<ll>()
# define Type template<typename T>
Type T read1(){
	T t=0;
	char k;
	bool vis=0;
	do (k=getchar())=='-'&&(vis=1);while('0'>k||k>'9');
	while('0'<=k&&k<='9')t=(t<<3)+(t<<1)+(k^'0'),k=getchar();
	return vis?-t:t;
}
# define fre(k) freopen(k".in","r",stdin);freopen(k".out","w",stdout)
ll n;
int main(){
	n=read;ll v=9e18,x=0;
	for(ll i=0;i<62;++i)
		if((n>>i)+i+(n&(1ll<<i)-1)<v)
			v=(n>>i)+i+(n&(1ll<<i)-1),x=i;
	cout<<v;
	return 0;
}
