The Portuguese Restoration War  was the name given by nineteenth-century Romantic historians to the war between Portugal and Spain that began with the Portuguese revolution of 1640 and ended with the Treaty of Lisbon in 1668. The revolution of 1640 ended the 60-year Iberian Union. The period from 1640 to 1668 was marked by periodic skirmishes between Portugal and Spain, as well as short episodes of more serious warfare, much of it occasioned by Spanish and Portuguese entanglements with non-Iberian powers. Spain was involved in the Thirty Years' War until 1648 and the Franco-Spanish War until 1659, while Portugal was involved in the Dutch-Portuguese War until 1663. In the seventeenth century and afterwards, this period of sporadic conflict was simply known, in Portugal and elsewhere, as the Acclamation War. The war established the House of Braganza as Portugal's new ruling dynasty, replacing the House of Habsburg. This ended the so-called Iberian Union.
Question: How many wars was Spain in?
Answer: 4