Checking position of each element after sorting