Min Operations to Reduce to 0

Reduce a given positive integer n to 0 by repeatedly adding or subtracting any power of two. Each addition or subtraction of a power of two counts as one operation. Find the minimum number of such operations needed.

Examples
Input: 3
Output: 2
Hints

Min Operations to Reduce to 0

Reduce a given positive integer `n` to 0 by repeatedly adding or subtracting any power of two. Each addition or subtraction of a power of two counts as one operation. Find the minimum number of such operations needed.