Finding Position

Given an integer A which denotes the number of people standing in the queue.

A selection process follows a rule where people standing on even positions are selected.
Of the selected people a queue is formed and again out of these only people on even position are selected.

This continues until we are left with one person. Find and return the position of that person in the original queue.



Input Format

The only argument given is integer A.

Output Format

Return the position of the last selected person in the original queue.

Constraints

1 <= A <= 10^9

For Example

Input 1:
    A = 10
Output 1:
    8

Input 2:
    A = 20
Output 2:
    16
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Finding Position on Interview Code Editor
Sign Up
to access hints and editorial solutions for Finding Position

Discussion


Loading...
Click here to start solving coding interview questions