sorts index by difference