The bus driver picks up the children from their homes every morning for school. All the homes are positioned around a circular street and the bus driver has to stop at every home exactly once.
One monday morning the bus driver decided to only pick up every second child he encountered along his way. However, he still had to pick up every single children, so this meant he was willing to go multiple rounds.
The houses are indexed from 1 to N (they come in order). The bus driver starts at the first (index 1) house and does not change directions during his trip. You must find the index of the house the last child is picked up from.
A single positive number
N read from the standard input representing the number of houses along the street.
Output the index of the house the last child is picked up from to the standard output.
The order of pickups are as follows: 1 3 5 7 9 2 6 10 8 4
Shortest code wins!