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