Define as

..........n/2 ----------when n is even

f(n) =

..........(1-n)/2 ---------when n is odd

The first one is a simple exercise to show injectivity and surjectivity. Do it for this too.

P.S: How do we put the huge bracket for such piecewise defined function in TeX? Thanks