Sort items ids.