A prince picked a basketful of golden apples in the enchanted orchard. On his way home, he was stopped by a troll who guarded. T
he troll demanded payment of 1/2 of the apples plus two more. The prince gave him the apples and set off. A little further on, he was stopped by a second troll guard who demanded a payment of 1/2 of the apples the prince now had plus two more. The prince paid and set off again. Just before leaving the orchard, a third troll stopped him demanding 1/2 of his remaining apples plus two more. Sadly, the prince paid him and went home. He had only two golden apples left. How many apples had he picked?