A function such that $f(f(n)) = -n$? This question from somebody's job interview made me puzzled:
Design a function f, such that:
$f(f(n)) = -n$ ,
where n is a 32 bit signed integer; you can't use complex numbers arithmetic. If you can't design such a function for the whole range of numbers, design it for the largest range possible.
Do you have any idea how to tackle it?
EDIT: I removed "Real number" from the title, since it just confused readers, but it was meant just to stress that complex numbers are not allowed.

If the number is odd, then subtract one.  If the number is even, then add one and then multiply by negative 1.  
(Similarly, you could just flip the first, or the last, or any number of the 32 bits, and multiply by -1 if the flipped bit is a $0$.)  
