The last action of the war was on the part of the Catalan barons of Roussillon and Cerdagne, which had been assigned to France as surety for war subsidies. The French were only slowly expelled. On 1 February 1473, John entered Perpignan to the joy of its citizens. He placed Catalan garrisons in the castles of Bellegarde, Collioure, and Salses. The French, angered by the abridgement of the treaty of Bayonne, counter-attacked a few weeks later, but some Castilian troops under Prince Ferdinand successfully resisted. John began negotiations that led to a truce in July and a treaty at Perpignan on 17 September. John recognised the treaty of Bayonne in return for French recognition of his sovereignty in the disputed provinces. John agreed to pay 300,000 écus, and Roussillon and Cerdagne were proclaimed "neutral" until the payment was made. John returned to Barcelona triumphant, but failed to raise the necessary funds. In the summer of 1474 the French conquered Roussillon and March 1475 Perpignan fell to them. The French raided the Empordà as far as Girona in 1476, and John, his allies tied up by their own wars, could not even oppose them. In October 1478 he ceded the two provinces to France until he could redeem them with cash. Revolts against his authority flared in Aragon and Valencia, which had stayed out of the civil war, and he failed to put them down. He did succeed in quashing a revolt in Sardinia.
Question: How many years after John entered Perpignan did he cede it to France?
Answer: 5