#include using namespace std; int main() { int64_t n; cin >> n; int64_t ans = 0, x = 1; for (; x < n; x *= 2, ans++); for (; x != n; x--, ans++); cout << ans << endl; return 0; }