A castle in the faraway land of Aluossim was surrounded by four moats. One day the castle was besieged by a fierce tribe. from the north. Guards were stationed at each bridge. King Juanaricmo was allowed to take a number of bags of gold from the castle as he went into exile. However, the guard at the first bridge demanded half the bags of gold plus one more bag. King Juanaricmo met this demand and proceeded to the next bridge. The guards at the seoond, third, and fourth bridges made identical demands, all of which the king met. When the king finally crossed all the bridges, he had a single bag of gold left. With how many bags did he start?