Compare the index of distance