Given that all the numbers form 0 to N-1 are to be stored, and their order, there will be N! permutations. The minimum number of bits needed to store any combination and its order from an randomly selected order will be
$$\lceil \frac{\log(n!)}{\log(2)}\rceil$$
For example give a range of {0..99} (N=100) the Number of bits to store the permutations is $\lceil \frac{\log(100!)}{\log(2)}\rceil = 525\text{bits}$.
This can be encoded using a Mixed-Radix Calculation, or can be done using Arithmetic Coding (with a slight extra few bits).
In short using a LIST of the numbers to choose from. Each time one of the numbers is eliminated, to take the last number in the list, move it to fill in the eliminated number, adjust the "stats" for Arithmetic coding. Since All the symbols are equally, the same percent applies to all the symbols, and makes easy and Linear time to encode.
Each elimination increase percent chance of the next symbol (IE Number) occurring in the remaining of the list using list of the 0..(N-1) and using the move the last item to the empty position, and shorten the list.
A hash table can be used to make finding the number to replace be done in $\mathcal O(1)$ expected time, for the $\mathcal O(N)$ sequence.