During a recent expedition, three intrepid adventurers were left stranded in the middle of the desert with only a crate full of apples.
During the night, Alan woke up and decided to hide his share of the apples and hid a third, then promptly fell asleep again.
Brian woke up shortly after and also decided to hide a third of the remaining apples and he also dozed back to sleep.
Finally, Charles woke up and seeing the others were asleep, took a third of what was left.
Of course none of the adventurers knew of the other's antics, so, in the morning, they shared the remaining apples, each receiving sixteen. How many apples were in the crate originally?