FJ knows that the cows (like everyone else) love bonbons, which are very expensive candy. He has decided to purchase and give a single bonbon to one of his N (1 ≤ N ≤ 7,100,000) cows (which are conveniently numbered 1..N). He lines the cows up in order in a circle and starts with cow 1. He moves to cow 2 and asks her to leave the circle. He moves to cow 4 and asks her to leave. He continues to ask every other cow to leave the circle until only one remains -- and she gets the bonbon.
Determine which cow gets the bonbon.
Initial circle: 1 2 3 4 5 6 7
Becomes: 1 3 4 5 6 7
Becomes: 1 3 5 6 7
Becomes: 1 3 5 7
Becomes: 3 7
Becomes: 7