Cycle shifts#27

Cycle shifts

1 segundo
128 megabytes
Fácil

Let us write the integer in binary notation and generate all its left cyclic shifts, moving the first digit to the end each time.

For example, if n = 11, in binary this is . Its cyclic shifts are , , , . The maximum value among all obtained numbers is 1110_2 = 14_{10}.

Find the maximum value that can be obtained from all left cyclic shifts of the binary representation of the given .

Entrada

One integer (1 \leq n \leq 2 \cdot 10^9).

Salida

One integer .

Ejemplos

Ejemplo 11

Loading
Loading