Base-10 Complement

Every non-negative integer n has a binary representation. Flip all bits up to the highest set bit to produce its complement. For n = 0, whose binary is "0", the complement is "1", so return 1. Return the complement as an integer.

Examples
Input: 5
Output: 2
Hints

Base-10 Complement

Every non-negative integer n has a binary representation. Flip all bits up to the highest set bit to produce its complement. For n = 0, whose binary is "0", the complement is "1", so return 1. Return the complement as an integer.