<P> It is not usual for a dynasty to transition so smoothly into another, as is depicted in history timelines, since dynasties were often established before the overthrow of an existing reign, or continued for a time after they had been defeated . For example, the conventional date 1645 marks the year in which the Qing dynasty armies replaced the preceding Ming dynasty according to the dynastic cycle . However, the Qing dynasty was established in 1636 (or even 1616, albeit under a different name), while the last Ming dynasty pretender was not deposed until 1663 . This change of ruling houses was a messy and prolonged affair, and the Qing took almost twenty years to extend their control over the whole of China . It is therefore inaccurate to assume China changed suddenly and all at once in the year 1645 . </P> <P> In addition, China was divided for short periods of its history, with different regions being ruled by different groups . At times like these, there was not any single dynasty ruling a unified China . As a case in point, there is much dispute about times in and after the Western Zhou period . In the Chinese historiographical tradition, each new dynasty would write the history of the dynasty which preceded it . This cycle was disrupted, however, when the Xinhai Revolution overthrew the Qing dynasty in favor of a republic . Even an attempt by Republicans to draft the history of the Qing was disrupted by the Chinese Civil War, which resulted in the division of China into the People's Republic of China on mainland China and the Republic of China on Taiwan . </P> <Table> <Tr> <Th_colspan="4"> Dynasty </Th> <Th> Rulers </Th> <Th> Ruling house or clan of houses </Th> <Th> From </Th> <Th> To </Th> <Th> Term </Th> </Tr> <Tr> <Th> Name </Th> <Th> Chinese <P> (Traditional </P> <P> / Simplified) </P> </Th> <Th> Pinyin </Th> <Th> Meaning </Th> </Tr> <Tr> <Th_colspan="9"> Confederacy dynasties </Th> </Tr> <Tr> <Td> Xia dynasty </Td> <Td> 夏 </Td> <Td> Xià </Td> <Td> Tribe name </Td> <Td> (list) </Td> <Td> Sì (姒) </Td> <Td> 2070 BC </Td> <Td> 1600 BC </Td> <Td> 470 years </Td> </Tr> <Tr> <Td> Shang dynasty </Td> <Td> 商 </Td> <Td> Shāng </Td> <Td> Toponym </Td> <Td> (list) </Td> <Td> Zǐ (子) </Td> <Td> 1600 BC </Td> <Td> 1046 BC </Td> <Td> 554 years </Td> </Tr> <Tr> <Td> Western Zhou dynasty </Td> <Td> 西周 </Td> <Td> Xī Zhōu </Td> <Td> Toponym </Td> <Td> (list) </Td> <Td> Jī (姬) </Td> <Td> 1046 BC </Td> <Td> 771 BC </Td> <Td> 275 years </Td> </Tr> <Tr> <Td> Eastern Zhou dynasty </Td> <Td> 東周 / 东周 </Td> <Td> Dōng Zhōu </Td> <Td> Toponym </Td> <Td> (list) </Td> <Td> Jī (姬) </Td> <Td> 770 BC </Td> <Td> 256 BC </Td> <Td> 515 years </Td> </Tr> <Tr> <Td> Spring and Autumn period </Td> <Td> 春秋 </Td> <Td> Chūn Qiū </Td> <Td> As English </Td> <Td> </Td> <Td> </Td> <Td> 770 BC </Td> <Td> 476 BC </Td> <Td> 295 years </Td> </Tr> <Tr> <Td> Warring States period </Td> <Td> 戰國 / 战国 </Td> <Td> Zhàn Guó </Td> <Td> As English </Td> <Td> </Td> <Td> </Td> <Td> 476 BC </Td> <Td> 221 BC </Td> <Td> 255 years </Td> </Tr> <Tr> <Th_colspan="9"> Imperial dynasties </Th> </Tr> <Tr> <Td> Qin dynasty </Td> <Td> 秦 </Td> <Td> Qín </Td> <Td> Toponym </Td> <Td> (list) </Td> <Td> Yíng (嬴) </Td> <Td> 221 BC </Td> <Td> 206 BC </Td> <Td> 15 years </Td> </Tr> <Tr> <Td> Western Han dynasty </Td> <Td> 西漢 / 西汉 </Td> <Td> Xī Hàn </Td> <Td> Toponym </Td> <Td> (list) </Td> <Td> Liú (劉) </Td> <Td> 206 BC or 202 BC </Td> <Td> AD 9 </Td> <Td> 215 years </Td> </Tr> <Tr> <Td> Xin dynasty </Td> <Td> 新 </Td> <Td> Xīn </Td> <Td> "New" </Td> <Td> (list) </Td> <Td> Wáng (王) </Td> <Td> AD 9 </Td> <Td> AD 23 </Td> <Td> 14 years </Td> </Tr> <Tr> <Td> Eastern Han dynasty </Td> <Td> 東漢 / 东汉 </Td> <Td> Dōng Hàn </Td> <Td> Toponym </Td> <Td> (list) </Td> <Td> Liú (劉) </Td> <Td> AD 25 </Td> <Td> AD 220 </Td> <Td> 195 years </Td> </Tr> <Tr> <Td> Three Kingdoms </Td> <Td> 三國 / 三国 </Td> <Td> Sān Guó </Td> <Td> As English </Td> <Td> (list) </Td> <Td> Cáo (曹) Liú (劉 / 刘) Sūn (孫 / 孙) </Td> <Td> AD 220 </Td> <Td> AD 280 </Td> <Td> 60 years </Td> </Tr> <Tr> <Td> Western Jin dynasty </Td> <Td> 西晉 / 西晋 </Td> <Td> Xī Jìn </Td> <Td> Toponym </Td> <Td> (list) </Td> <Td> Sīmǎ (司馬) </Td> <Td> AD 265 </Td> <Td> AD 317 </Td> <Td> 52 years </Td> </Tr> <Tr> <Td> Eastern Jin dynasty </Td> <Td> 東晉 / 东晋 </Td> <Td> Dōng Jìn </Td> <Td> Toponym </Td> <Td> (list) </Td> <Td> Sīmǎ (司馬) </Td> <Td> AD 317 </Td> <Td> AD 420 </Td> <Td> 103 years </Td> </Tr> <Tr> <Td> Southern and Northern dynasties </Td> <Td> 南北朝 </Td> <Td> Nán Běi Cháo </Td> <Td> As English </Td> <Td> (list) </Td> <Td> various </Td> <Td> AD 420 </Td> <Td> AD 589 </Td> <Td> 169 years </Td> </Tr> <Tr> <Td> Sui dynasty </Td> <Td> 隋 </Td> <Td> Suí </Td> <Td> Ducal title (随 homophone) </Td> <Td> (list) </Td> <Td> Yáng (楊) </Td> <Td> AD 581 </Td> <Td> AD 618 </Td> <Td> 38 years </Td> </Tr> <Tr> <Td> Tang dynasty </Td> <Td> 唐 </Td> <Td> Táng </Td> <Td> Ducal title </Td> <Td> (list) </Td> <Td> Lǐ (李) </Td> <Td> AD 618 </Td> <Td> AD 907 </Td> <Td> 289 years </Td> </Tr> <Tr> <Td> Five Dynasties and Ten Kingdoms </Td> <Td> 五代 十 國 <P> / 五代 十 国 </P> </Td> <Td> Wǔ Dài Shí Guó </Td> <Td> As English </Td> <Td> (list) </Td> <Td> various </Td> <Td> AD 907 </Td> <Td> AD 960 </Td> <Td> 53 years </Td> </Tr> <Tr> <Td> Kingdom of Dali </Td> <Td> 大理 國 <P> / 大理 国 </P> </Td> <Td> Dà Lǐ Guó </Td> <Td> Toponym </Td> <Td> (list) </Td> <Td> Duan (段) </Td> <Td> AD 937 </Td> <Td> AD 1253 </Td> <Td> 316 years </Td> </Tr> <Tr> <Td> Northern Song dynasty </Td> <Td> 北宋 </Td> <Td> Běi Sòng </Td> <Td> Toponym </Td> <Td> (list) </Td> <Td> Zhào (趙) </Td> <Td> AD 960 </Td> <Td> AD 1127 </Td> <Td> 167 years </Td> </Tr> <Tr> <Td> Southern Song dynasty </Td> <Td> 南宋 </Td> <Td> Nán Sòng </Td> <Td> Toponym </Td> <Td> (list) </Td> <Td> Zhào (趙) </Td> <Td> AD 1127 </Td> <Td> AD 1279 </Td> <Td> 152 years </Td> </Tr> <Tr> <Td> Liao dynasty </Td> <Td> 遼 / 辽 </Td> <Td> Liáo </Td> <Td> "Vast" or "Iron" (Khitan homophone) </Td> <Td> (list) </Td> <Td> Yelü (; 耶律) </Td> <Td> AD 907 or 916 </Td> <Td> AD 1125 </Td> <Td> 209 years </Td> </Tr> <Tr> <Td> Jin dynasty </Td> <Td> 金 </Td> <Td> Jīn </Td> <Td> "Gold" </Td> <Td> (list) </Td> <Td> Wanggiya (; 完 顏) </Td> <Td> AD 1115 </Td> <Td> AD 1234 </Td> <Td> 119 years </Td> </Tr> <Tr> <Td> Western Xia </Td> <Td> 西夏 </Td> <Td> Xī Xià </Td> <Td> Toponym </Td> <Td> (list) </Td> <Td> Li (𘝾; 李) </Td> <Td> AD 1038 </Td> <Td> AD 1227 </Td> <Td> 189 years </Td> </Tr> <Tr> <Td> Western Liao </Td> <Td> 西 遼 </Td> <Td> Xī Liáo </Td> <Td> "Vast" or "Iron" (Khitan homophone) </Td> <Td> (list) </Td> <Td> Yelü (; 耶律) </Td> <Td> AD 1124 </Td> <Td> AD 1218 </Td> <Td> 94 years </Td> </Tr> <Tr> <Td> Yuan dynasty </Td> <Td> 元 </Td> <Td> Yuán </Td> <Td> "Great" or "Primacy" </Td> <Td> (list) </Td> <Td> Borjigin (ᠪᠣᠷᠵᠢᠭᠢᠨ; 孛 兒 只 斤) </Td> <Td> AD 1271 </Td> <Td> AD 1368 </Td> <Td> 97 years </Td> </Tr> <Tr> <Td> Ming dynasty </Td> <Td> 明 </Td> <Td> Míng </Td> <Td> "Bright" </Td> <Td> (list) </Td> <Td> Zhū (朱) </Td> <Td> AD 1368 </Td> <Td> AD 1644 or 1662 </Td> <Td> 276 years </Td> </Tr> <Tr> <Td> Qing dynasty </Td> <Td> 清 </Td> <Td> Qīng </Td> <Td> "Pure" </Td> <Td> (list) </Td> <Td> Aisin Gioro (ᠠᡳᠰᡳᠨ ᡤᡳᠣᡵᠣ; 愛 新 覺 羅) </Td> <Td> AD 1636 or 1644 </Td> <Td> AD 1912 </Td> <Td> 268 years </Td> </Tr> </Table> <Tr> <Th_colspan="4"> Dynasty </Th> <Th> Rulers </Th> <Th> Ruling house or clan of houses </Th> <Th> From </Th> <Th> To </Th> <Th> Term </Th> </Tr>

How many dynasties were there in ancient china
find me the text answering this question