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, Aakash woke up and decided to hide his share of apples and hid a third, then promptly fell asleep again. Bhavesh woke up shortly after and also decided to hide a third of the remaining apples and he also dozed back to sleep. Finally, Himanshu woke up and seeing the others were asleep, took a third of what was left. Of course none of the adventurers knew the other's antics, so, in the morning, they shared the remaining apples, each receiving sixteen.

How many apples were in the crate originally?