331 years Mughal Empire exist in India. The first Mughal emperor Babur founded Mughal Empire in 1526 and the last Mughal Emperor Bahadur Shah Zafar was exiled in 1857. So if we calculated the time (1857–1526=331) So Mughal Empire lasted for 331 years.
But the Mughal Empire had only 6 great emperors who were:
5. Shah Jahan
6. Alamgir (Aurangzeb)
After these 6 emperors came Later Mughals who were not at all capable of ruling the vast empire.
So as I have mentioned earlier Babur came in 1526 and Aurangzeb breathed his last in 1707. (1707–1526=181)
So real Mughal empire lasted for 181 years.