A group of hardy pirates are sailing along when they encounter the Royal Navy of Lord Richard. The battle is long and vicious. Sadly, the pirate ship is sunk. The only survivors are five of the crew and the captain's foul-mouthed parrot. The lot make it to a tiny island nearby in time to watch the Navy's vessel disappear over the horizon. Disheartened but determined to survive, the 5 crewman go foraging. The only food they are able to gather is a collection of mangoes. (They're terrible hunters and fisherman.) The parrot finds some nuts but it's not sharing. The pirates pile up all their mangoes and go to sleep.
Some time in the night, one of the crew wake up. Worried that he won't get his fair share in the morning - pirates are so rude, after all - he divides the big pile into 5 smaller piles. There's one left over, so he tosses it to the parrot. He hides one of the smaller piles, rolls the rest back into a single pile, and goes to sleep.
After the first pirate has fallen asleep, a second pirate wake up. He, too, is worried about getting his fair share. Being of the same mindset of the first to awake, the second pirate also divides the big pile (actually, it's what's left of the original pile after the first got done with it but the second doesn't know that) into 5 smaller piles. Again, there's one left over so he tosses it to the parrot. He hides his pile, rolls the rest back together, and goes to bed.
This repeats for every pirate. Each divides what's left into 5 piles, gives the 1 leftover to the parrot, hides their pile, and rolls the rest back together.
When the sun comes up, all the pirates notice that what's left in the pile is much smaller than the night before. None of them say anything, though, because they're all guilty and don't want the others to decide to eat him instead. They divide up what's left into 5 piles. This time, there's none leftover for the parrot. (Suits it right. The dang thing never even thanked them for the mangoes last night.)
All the pirates munch on their pile while thinking about their secret stash they can sneak back to later. One dies later of an infected cut he received during the battle. The rest are rescued by a passing ship. Three more are killed when the rescue ship is sunk by a storm. The last survives in a dinghy and eventually reaches the mainland. He lives for another 26 years, eventually dying of heart disease. He never found true love or happiness in life. His fondest memory is of eating mangoes on a tropical island with 4 men he had bonded with through the fires of battle.
What is the minimum number of mangoes in the original pile?
Note that mangoes are counted as integers.
There will be no decimal or negative mangoes allowed.