#include #define rep(i,n) for(int i=0;i<(int)(n);i++) using namespace std; using ll = long long ; using P = pair ; using pll = pair; constexpr int INF = 1e9; constexpr long long LINF = 1e17; constexpr int MOD = 1000000007; int n; map dp; int dfs(int x){ if(dp.count(x) > 0) return dp[x]; if(x%2==0) return dp[x] = 1 + dfs(x/2); return dp[x] = 1 + dfs(x-1); } int main(){ cin >> n; dp[1] = 0; cout << dfs(n) << endl; return 0; }