/*
ID: omohamadooo
TASK: barn1
LANG: C++
*/
/*
      ___           ___           ___           ___           ___           ___           ___          _____          ___           ___           ___
     /  /\         /__/\         /  /\         /__/\         /  /\         /__/\         /  /\        /  /::\        /  /\         /  /\         /  /\
    /  /::\       |  |::\       /  /::\        \  \:\       /  /::\       |  |::\       /  /::\      /  /:/\:\      /  /::\       /  /::\       /  /::\
   /  /:/\:\      |  |:|:\     /  /:/\:\        \__\:\     /  /:/\:\      |  |:|:\     /  /:/\:\    /  /:/  \:\    /  /:/\:\     /  /:/\:\     /  /:/\:\
  /  /:/  \:\   __|__|:|\:\   /  /:/  \:\   ___ /  /::\   /  /:/~/::\   __|__|:|\:\   /  /:/~/::\  /__/:/ \__\:|  /  /:/  \:\   /  /:/  \:\   /  /:/  \:\
 /__/:/ \__\:\ /__/::::| \:\ /__/:/ \__\:\ /__/\  /:/\:\ /__/:/ /:/\:\ /__/::::| \:\ /__/:/ /:/\:\ \  \:\ /  /:/ /__/:/ \__\:\ /__/:/ \__\:\ /__/:/ \__\:\
 \  \:\ /  /:/ \  \:\~~\__\/ \  \:\ /  /:/ \  \:\/:/__\/ \  \:\/:/__\/ \  \:\~~\__\/ \  \:\/:/__\/  \  \:\  /:/  \  \:\ /  /:/ \  \:\ /  /:/ \  \:\ /  /:/
  \  \:\  /:/   \  \:\        \  \:\  /:/   \  \::/       \  \::/       \  \:\        \  \::/        \  \:\/:/    \  \:\  /:/   \  \:\  /:/   \  \:\  /:/
   \  \:\/:/     \  \:\        \  \:\/:/     \  \:\        \  \:\        \  \:\        \  \:\         \  \::/      \  \:\/:/     \  \:\/:/     \  \:\/:/
    \  \::/       \  \:\        \  \::/       \  \:\        \  \:\        \  \:\        \  \:\         \__\/        \  \::/       \  \::/       \  \::/
     \__\/         \__\/         \__\/         \__\/         \__\/         \__\/         \__\/                       \__\/         \__\/         \__\/

*/

#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define endl '\n'
#define pii pair<ll,ll>
#define F first
#define S second

using namespace std;

const int MOD=1e9+7;
const int  N=1000100;

long long po(ll x,ll y)
{
    ll ans=1;
    while(y){
        if(y & 1) ans=(ans*x);//%MOD;
        y/=2;
        x=(x*x);//%MOD;
    }
    return ans;
}

ll n;

void solve()
{
    ll ans=1e18;
    cin>>n;
    for(ll i=0;i<70;i++){
        if(po(2,i)>n)
            break;
        ll b=n/po(2,i);
        ans=min(ans,i+b+(n-(po(2,i)*b)));
    }
    cout<<ans<<endl;
}

int main()
{
    //ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("hopscotch.in","r",stdin);freopen("hopscotch.out","w",stdout);
    int t=1;
    //cin>>t;
    while(t--){
        solve();
    }
}

#include <iostream>
#include <vector>
#include <complex>

using namespace std;

using C = complex<double>;
C rotate(C center, C vec, double rad) {
    C r = {cos(rad), sin(rad)};
    return center + (vec-center) * r;
}

int main() {
    int N; cin >> N;
    double x, y;
    cin >> x >> y;
    C s = {x, y};
    cin >> x >> y;
    C t = {x, y};
    C center = (s+t)/2.0;
    double pi = acos(-1);
    double rad = 2*pi/N;
    auto res = rotate(center, s, rad);
    printf("%.10f %.10f\n", res.real(), res.imag());
}