Encoding order of numbers in an ascending set of numbers Say I have a set of numbers $14,2,8,7$ and I want to send them to my friend in the correct order, but to be sent I have to put them through a filter, that filter is going to sort them into ascending order ($2,7,8,14$) which would be incorrect. Is there some way I can either add numbers to the set or modify the original numbers to encode the order into them, without dramatically increasing the size of the numbers or the number of numbers.
I am only dealing with positive integers, and in my specific situation, I only need to encode 4-32 numbers between 255-32. I would prefer them to not become too large (More than double their original number) or to add too many numbers to the set (More than double the original length of the set)
I already have my own solution but I want to see more.
My Solution: Take the position and turn it into binary and append it to the original number, this would result in $4$ ($0010$) in the 3rd position ($10$) in the set turning into $34$ ($100010$)
(Note: For more examples see Gerry Myerson's solutions answered below)
 A: The question having been reopened, I'll elevate my comments to an answer.
First method. Encode $a_1,a_2,\dots,a_n$ as $a_1,a_1+a_2,\dots,a_1+a_2+\cdots+a_n$. For example, $6,1,2,7$ encodes as $6,7,9,16$. The encoded sequence is already increasing, so the filter passes it to the friend unchanged. The friend, receiving $b_1,b_2,\dots,b_n$, retrieves the original sequence as $b_1,b_2-b_1,\dots,b_n-b_{n-1}$. In the example, $6,7,9,16$ decodes as $6,7-6,9-7,16-9$ which is $6,1,2,7$, as we wanted. The advantage of this method is that we don't increase the length of the sequence; the disadvantage is that the last term in the encoded sequence, $a_1+a_2+\cdots+a_n$, can be considerably larger than the terms we started with.
Second method. Let $\max\{a_1,a_2,\dots,a_n\}=m$. Encode $a_1,a_2,\dots,a_n$ as $a_1,a_2,\dots,a_n,b_1,b_2,\dots,b_n$ where the $b_i$ are chosen so that the numbers $b_1-m,b_2-b_1,\dots,b_n-b_{n-1}$ encode the information needed to undo the effect of the filter on $a_1,a_2,\dots,a_n$. This is easier to understand by looking at our example:
We encode $6,1,2,7$ as $6,1,2,7,10,11,13,17$. The filter turns this into $1,2,6,7,10,11,13,17$. The friend calculates $10-7=3$, $11-10=1$, $13-11=2$, $17-13=4$, and then uses these differences $3,1,2,4$ to unscramble the received $1,2,6,7$ by writing the 3rd term, then the 1st, then the 2nd, then the 4th; $6,1,2,7$.
The second method has the disadvantage of making the sequence twice as long, but the advantage of not making the numbers that much larger.
