#P275. 【例45.4】 数位翻转

【例45.4】 数位翻转

Description

Given a number nn, you can perform several operations. Each operation can flip a bit in the binary representation of nn (i.e., change 00 to 11 or 11 to 00).
Question: What is the minimum number of operations required to change nn to n1n-1?

Input Format

A positive integer nn (1<n1091 < n \le 10^9)

Output Format

Output the minimum number of operations.

Sample

10
2