Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/bit-oraliq-and

AND of a range

Medium 1000 ms 128 MB 51%
Share

Integers $l \le r$ are given. Find $l \,\&\, (l + 1) \,\&\, \ldots \,\&\, r$. Here $\&$ is the bitwise AND operation: a position of the binary representation gives $1$ where both bits are $1$, and $0$ otherwise.

Binary representations of the numbers from l to r one under another; the left part common to all of them is highlighted

Input

One line with two integers: $l$ and $r$.

Output

One integer — the result.

Note

$0 \le l \le r \lt 2^{60}$

Examples

Input #1
12 15
Output #1
12
Input #2
5 7
Output #2
4

Sign in to submit a solution

Signing up is free and takes a minute.