#include <iostream>

using namespace std;

int N;

int main () {
  //freopen ("test.in", "r", stdin);
  //freopen ("test.out", "w", stdout);

  scanf ("%d", &N);
  int ans = __builtin_popcount (N) - 1;
  //if (__builtin_popcount (N) == 1) ans--;
  while (N) ans++, N >>= 1;
  ans--;
  printf ("%d\n", ans);


 // printf ("%d\n", N);
}