#include int main(void){ int N, i = 0, X = 1; scanf("%d", &N); while(X < N){ X *= 2; i++; } while(X != N){ X--; i++; } printf("%d\n", i); return 0; }