David goes to his nearby woods to pluck apples from a tree every day. On this day, he is encountered with a check post and a guard to enter the woods. The guard asks for half of the apples in exchange to let him pass. David agrees on the terms that the guard returns David one apple from the lot that David gives to the guard. He continues to find another check post with another guard. He makes the same promise and continues. Then there is a third check post and guard. Same promise. He finally reaches the tree, plucks a few apples. He fulfils his promise to every guard and still returns home with the same number of apples as he has plucked. How many apples were there?