Problem1526--Digital inversion

1526: Digital inversion

[Creator : ]
Time Limit : 1 sec  Memory Limit : 128 MB

Description

Given an integer, please invert the number of bits in each number and get a new number. The new number should also meet the common form of integers, that is, unless the given original number is zero, the highest number of the new number of new numbers obtained after the reversal should not be zero (for example: input -380, output -83)

Input

Input a total of 1 lines, an integer N.

Output

Output a total of 1 rows, an integer, indicating the new number after inversion.

Sample Input Copy

123

Sample Output Copy

321

HINT

-1,000,000,000<=N<=1,000,000,000。

NOIP2011 普及组 reverse

Source/Category