#include "bits/stdc++.h" using namespace std; int main() { int N, X = 1, ans = 0; cin >> N; for(; X < N;) { X = X << 1; ans++; } if(X != N) { ans += X - N; } cout << ans << '\n'; return 0; }