The algorithm for finding distinct pizzas v1