#include int main(void) { int N, M, i, j, X; scanf("%d", &N); X = 1; i = 0; j = 0; for (i = 0; N % 2==0 && N != 2;i++){ N = N / 2; } if (N > 1) { for (j = 0; N > X; j++) { X = 2 * X; } } M = i + X - N + j; printf("%d", M); printf("\n"); return 0; }