Sorted Unique Permutation Formula Derivation