10

// Task: add one to the input number

// Sane people:
// print(int(input())+1)

// Me:

n = [*(reversed(bin(int(input()))[2:]))]

tmp = ""
for i in range(len(n)):
tmp = n[i]
tmp = "1" if tmp == "0" else "0"
n[i] = tmp
if tmp == "1":break

if tmp == "0":n+=["1"]
n = "".join(reversed(n))

n = int(n,2)
print(n)

Comments
Add Comment