were the same ones that were built by the first emperor in the 3rd century BC. When China opened its borders to foreign merchants and visitors after its defeat in the First and Second Opium Wars, the Great Wall became a main attraction for tourists. The travelogues of the later 19th century further enhanced the reputation and the mythology of the Great Wall. Course A formal definition of what constitutes a "Great Wall" has not been agreed upon, making the full course of the Great Wall difficult to describe in its entirety. The defensive lines contain multiple stretches of ramparts, trenches and ditches, as well as individual fortresses. In 2012, based on existing research and the results of a comprehensive mapping survey, the National Cultural Heritage Administration of China concluded that the remaining Great Wall associated sites include 10,051 wall sections, 1,764 ramparts or trenches, 29,510 individual buildings, and 2,211 fortifications or passes, with the walls and trenches spanning a total length of . Incorporating advanced technologies, the study has concluded that the Ming Great Wall measures . This consists of of wall sections, of trenches and of natural defensive barriers such as hills and rivers. In addition, Qin, Han and earlier Great Wall sites are long in total; Jin dynasty (1115–1234) border fortifications are in length; the remainder date back to Northern Wei, Northern Qi, Sui, Tang, the Five Dynasties, Song, Liao and Xixia. About half of the sites are located in Inner Mongolia (31%) and Hebei (19%). Han Great Wall Han fortifications starts from Yumen Pass and Yang Pass, southwest of Dunhuang, in Gansu province. Ruins of the remotest Han border posts are found in Mamitu ( Mǎmítú, ) near Yumen Pass. Ming Great Wall The Jiayu Pass, located in Gansu province, is the western terminus of the Ming Great Wall. From Jiayu Pass the wall travels discontinuously down the Hexi Corridor and into the deserts of Ningxia, where it enters the western edge of the Yellow River loop at Yinchuan. Here the first major walls erected during the Ming dynasty cut through the Ordos Desert to the eastern edge of the Yellow River loop. There at Piantou Pass Piāntóuguān) in Xinzhou, Shanxi province, the Great Wall splits in two with the "Outer Great Wall" Wài Chǎngchéng) extending along the Inner Mongolia border with Shanxi into Hebei province, and the "Inner Great Wall" Nèi Chǎngchéng) running southeast from