Sort the result before comparing