#include<bits/stdc++.h>
using namespace std; 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i < (int)(n); i++)
#define length size()
#define int long long
#define ll long long
#include <cstdint>
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    if(n==0) return 0;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
const int MOD = 1000000007;
const int mod = 998244353;
const int MAX = 510000;
const int inf = 400000000000000;
template<typename T> string join(vector<T> &vec ,const string &sp){
    int si = vec.length;
    if(si==0){
        return "";
    }else{
        stringstream ss;
        rep(i,si-1){
            ss << vec[i] << sp;
        }
        ss << vec[si - 1];
        return ss.str();
    }
}
vector<vector<int>> ruiseki2d(vector<vector<int>> vec){
    rep(i,vec.size()-1){
        rep(j,vec[0].size()-1){
            vec[i+1][j+1] = vec[i][j+1]+vec[i+1][j]-vec[i][j]+vec[i+1][j+1];
        }
    }
    return vec;
}
class CompareDist
{
public:
    bool operator()(pair<int,int> p,pair<int,int>q){
    return p.second > q.second;
}
};
int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
    default : return -1;
  }
}
vector<int> dijkstra(vector<vector<pair<int,int>>> vec,int s){
    priority_queue<pair<int,int>,vector<pair<int,int>>,CompareDist> que;
    pair<int,int> f = make_pair(s,0);//point,cost;
    que.push(f);
    bool y = false;
    vector<int> cost(vec.size(),inf);
    while(!que.empty()){
        pair<int,int> tmp = que.top();
        que.pop();
        int p = tmp.first;
        int c = tmp.second;
        if(cost[p]>c){
        cost[p] = c;
        rep(i,vec[p].size()){
            if(cost[vec[p][i].first]<=inf){
            tmp = make_pair(vec[p][i].first,vec[p][i].second+c);
            que.push(tmp);
            }
        }
        }
        if(!y) cost[p] = inf;
        y = true;
    }
    return cost;
}
signed main(void){
    int n;
    cin >> n;
    double ans = 0;
    rep(i,n){
        ans += (double)((double)1/((double)i+1));
    }
    cout << std::setprecision(20) <<ans*n-1 << endl;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(int i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    
    ll n; cin >> n;
    ll ans = INF, b = 0;
    while((1LL << b) <= n){
        ll a = n / (1LL << b);
        ll c = n % (1LL << b);
        ans = min(ans, a + b + c);
        b++;
    }
    print(ans)
    
    return 0;
}