After sorting a list in ascending order, the indices of elements in the sorted list may be different from their indices in the unsorted list. I want to know the original indices of elements in the sorted list. Is there any function that returns indices that would sort an array/list?

E.g.

If the unsorted list is [54,12,76,23,45,9,23,1], I want [7, 5, 1, 3, 6, 4, 0, 2] as the answer.

E.g.

If the unsorted list is [54,12,76,23,45,9,23,1], I want [7, 5, 1, 3, 6, 4, 0, 2] as the answer.