#include "guess.h"

int find_number( int MAX ) {
  int p = 1;
  for ( ; (1 << p) <= MAX; ++p );
  int x = 0;
  for ( --p; p >= 0; --p ) {
    if ( x + (1 << p) <= MAX && smaller(x + (1 << p)) ) {
      x += (1 << p);
    }
  }
  return x + 1;
}