sort and restore a set of bytes in optimal form
Python

The restore information is just the original list.  n bytes of restore information for an n byte list.

def sort(Y):
  return (sorted(Y), Y)

def restore(Q):
  return Q[1]