The Middle Kingdom of Egypt lasted from 2055 to 1650 BC. During this period, the Osiris funerary cult rose to dominate Egyptian popular religion. The period comprises two phases: the 11th Dynasty, which ruled from Thebes and the 12th and 13th Dynasties centered on el-Lisht. The unified kingdom was previously considered to comprise the 11th and 12th Dynasties, but historians now at least partially consider the 13th Dynasty to belong to the Middle Kingdom. During the Second Intermediate Period, Ancient Egypt fell into disarray for a second time, between the end of the Middle Kingdom and the start of the New Kingdom. It is best known for the Hyksos, whose reign comprised the 15th and 16th dynasties. The Hyksos first appeared in Egypt during the 11th Dynasty, began their climb to power in the 13th Dynasty, and emerged from the Second Intermediate Period in control of Avaris and the Delta. By the 15th Dynasty, they ruled lower Egypt, and they were expelled at the end of the 17th Dynasty.
Question: How many Dynasties did it take to expel them?
Answer: 17