The first emperor of the Ming dynasty, Zhu Yuanzhang (the Hongwu Emperor), who overthrew the Yuan dynasty, renamed the city Yingtian, rebuilt it, and made it the dynastic capital in 1368. He constructed a 48 km (30 mi) long city wall around Yingtian, as well as a new Ming Palace complex, and government halls. It took 200,000 laborers 21 years to finish the project. The present-day City Wall of Nanjing was mainly built during that time and today it remains in good condition and has been well preserved. It is among the longest surviving city walls in China. The Jianwen Emperor ruled from 1398 to 1402.