Task: Question Answering
Input (English): Passage: Guido Wald Rüdiger, count of Starhemberg;  was an Austrian military officer. He was a cousin of Ernst Rüdiger von Starhemberg , the famous commander of Vienna during the Turkish siege of 1683, and acted as his aide-de-camp during that siege. Guido followed his cousin, and later Prince Eugene of Savoy, in battles against the Turks. In the War of the Spanish Succession, Starhemberg fought in Italy and Spain. Between 1706 and 1708 he was the commander-in-chief of the imperial army in Hungary, leading military operations against the insurgents of Francis II Rákóczi. In 1708, he was appointed Supreme Commander of the Austrians in Spain. Together with James Stanhope he succeeded in conquering Madrid in 1710, after previously gaining victories at Almenar and Saragossa. In December, however, he was forced to leave the city by the lack of support by its inhabitants for the Habsburg pretender. After the subsequent defeats at the Battle of Brihuega and the Battle of Villaviciosa , he had to pull back to Catalonia, where he was made viceroy when Archduke Charles returned to Austria. After the Peace of Utrecht , archduke Charles, now Emperor Charles VI, ordered him to abandon Catalonia. He pulled back with his troops to Genoa on English ships. When he died in 1742, he was Governor of Slavonia. 
Question: How many years was Guido Wald Rüdiger the commander-in-chief of the imperial army in Hungary? 
Answer type: Number 
Output (English): 2.