Great! algorithm for sorted elements of list