local ffi = require("ffi") local C = ffi.C ffi.cdef[[ long long atoll(const char*); ]] local function lltonumber(str) return C.atoll(str) end local n = io.read() n = lltonumber(n) local z = n local mul = 1LL while 0LL < z do if z % 2LL == 1LL then mul = mul * 2LL end z = z / 2LL end local ans = n + 1 - mul ans = tostring(ans):gsub("LL", "") print(ans)