John went to meet his friend Jacob, but when he was about to reach the main gate, John notices that Jacob had a mighty dog who was fastened to the tree. The chain is long enough that it allows the dog to reach the main gate.
John gave half of the apples he had plus one more to Jacob. He gave half of the remaining ones plus one more to James. Now, John was left with just one apple.
Can you find out how many did he have in the beginning?