import math
def low_power(input):
return 1 << int(math.floor(math.log(input, 2)))
def survivor(count):
return 1 + 2 * (count - low_power(count))
for i in range(1, 101):
print '{} -> {}'.format(i, survivor(i))
print '{} -> {}'.format(98765432123456789, survivor(98765432123456789))
aW1wb3J0IG1hdGgKCmRlZiBsb3dfcG93ZXIoaW5wdXQpOgoJcmV0dXJuIDEgPDwgaW50KG1hdGguZmxvb3IobWF0aC5sb2coaW5wdXQsIDIpKSkKCmRlZiBzdXJ2aXZvcihjb3VudCk6CglyZXR1cm4gMSArIDIgKiAoY291bnQgLSBsb3dfcG93ZXIoY291bnQpKQoKZm9yIGkgaW4gcmFuZ2UoMSwgMTAxKToKCXByaW50ICd7fSAtPiB7fScuZm9ybWF0KGksIHN1cnZpdm9yKGkpKQoKcHJpbnQgJ3t9IC0+IHt9Jy5mb3JtYXQoOTg3NjU0MzIxMjM0NTY3ODksIHN1cnZpdm9yKDk4NzY1NDMyMTIzNDU2Nzg5KSkK