Matthias and Frederick III/V had been rivals stretching back to Matthias' succession as King of Hungary in 1458 after the early death of Frederick's Habsburg cousin King Ladislaus the Posthumous. At this time, Frederick held the Holy Crown of Hungary and was a candidate for becoming Hungarian king himself. Matthias, backed by the Bohemian king George of Poděbrady whose daughter Catherine  he married in 1461, finally prevailed: the two rivals settled their disagreements in 1463 with the Treaty of Wiener Neustadt, in which Frederick recognized the de facto King of Hungary and returned the Holy Crown to Matthias for a heavy ransom. With the consent of Pope Paul II, Matthias invaded Moravia in 1468, instigating the Bohemian War with his former ally George of Poděbrad, on the pretext of protecting Catholicism against the Hussite movement - in fact to depose his father-in-law King George. Welcomed by the German nobility in Silesia and the Lusatias, as well as by the Catholic Czechs in Moravia, Matthias acquired these territories for himself and in 1469 pronounced himself Bohemian king in Olomouc. Never able to seize the capital Prague however, Matthias' war would drag on with Poděbrad's successor, the Polish prince Vladislaus Jagiellon, until the latter recognized Matthias' gains in the 1478 Treaty of Brno. Emperor Frederick, at the same time stuck in the France-Habsburg rivalry over the Burgundian succession with King Louis XI of France, had initially assisted Matthias against the Hussites in the Bohemian War. Contributing very little however, Frederick soon came to reverse his role and forged an alliance with Poděbrad's successor Vladislaus whom he enfeoffed with the Kingdom of Bohemia in 1477. Angered by this action and recalling previous insults, Matthias proceeded to press for a peace with Vladislaus and invaded Frederick's Austrian lands.
Question: How many years after Matthias succeeded as King of Hungary did he and Frederick III/V settle their rivalry with the Treaty of Wiener Neustadt?
Answer: 5