What equation would produce the following results:

0 - > 0
1 - > 1
2 - > 2
3 - > 3
4 - > 4
5 - > 4
6 - > 3
7 - > 2
8 - > 1
9 - > 0

So for any n set of numbers, where n is always even, the result is that 0 and n-1 = 0; and (n/2) and ((n/2)-1) = (n-2)/2 and the numbers fill in in between? At least I think that is right. The idea is that the list on the left hand side is consecutive numbers and the list on the right hand side goes from 0 on up from both ends.

If this possible with an equation, or can it only be done by code?

Thanks for any help.