Limits 500ms, 512 MB

Meet Mr. Kamal. Last week he joined RE University, Sylhet as a lecturer.
He completed his B. Sc & M. Sc in Information Technology. And, he is very fond of Bit.

Today is his first day at work and he wants to start by quizzing his students about bits.

After entering the class he writes a number on the board and asks two students, Rafiq & Mahfuz, to answer this problem.

Rafiq and Mahfuz are both very intelligent. But sometimes Rafiq becomes anxious and gives the wrong answer. Mahfuz on the other hand sometimes has difficulty with calculation as he forgets things easily.

Now you have to help them solve the problem: Given some integers written side-by-side, you have to determine the distance between the left most 1-bit and the right most 1-bit in their binary representation. If the distance cannot be determined, print -1.

Input

The first line contains a single integer nn (2n1062 ≤ n ≤ 10^6). The second line contains nn non-negative integers r1r_1, r2r_2, ..., rnr_n (0ri2550 ≤ r_i ≤ 255).

Output

Print "Distance Between Two bits is : {distance}" where {distance} is the to be replaced by the distance you have determined (or -1).

Samples

InputOutput
3
1 2 3
Distance Between Two bits is : 15
InputOutput
3
1 2 0
Distance Between Two bits is : 6

Submit

Login to submit.

Statistics

69% Solution Ratio
Baka_RaffiEarliest, Dec '16
steinumFastest, 0.0s
steinumLightest, 5.5 kB
DarkD1Shortest, 353B
Toph uses cookies. By continuing you agree to our Cookie Policy.