#include #include int main(void) { int N; scanf("%d",&N); int T=N; int K=0; int S[1000000]; while(T!=0) { T=floor(T/2); S[K]=N+2*T; K++; N=N+T; } int max; max = S[0]; for (int i = 1; i < K; i++) { if (max < S[i]) { max = S[i]; } } int answer=max-N; printf("%d\n",answer); }