upvote
More seriously,

> You need a way to differentiate the two 5s

As there's no unique filtering or other reduction going on here, there's a permutation chain from input to output.

reply
But that's not in the specification given above. That specification is entirely wrong to specify SORT. It requires no duplicates survive the sorting process.
reply
In the cases of

  SORT ( 3, 2, 5, 5 ) ->> ( 2, 3, 5, 5 ) and
  SORT ( 3, 2, 5, 5 ) ->> ( 2, 3, 5, 5 )
one or both of those might be incorrect ?

( I'm teasing, perhaps )

reply