get and rm min and max for sorted list