The numbering of Popes John does not occur in strict numerical order. Although there have been twenty-one legitimate popes named John, the numbering has reached John XXIII because of two errors that were introduced in the Middle Ages. First, the Antipope John XVI was kept in the numbering sequence instead of being removed. Then, the number XX was skipped because Pope John XXI counted John XIV twice.
The number XX was skipped due to confusion over John XIV, which resulted from an error in the textual transmission of his entry in the Liber Pontificalis. This entry originally specified not only the duration of his pontificate , but also the duration of his ensuing imprisonment by Antipope Boniface VII, "per IV menses". In the 11th century, some time after the pontificate of John XIX, this entry on John XIV was misread to be referring to two different popes John, the first reigning for eight months and directly succeeded by another John reigning for four months: In distinguishing these two Johns, the second one came to be numbered as "Iohannes XIV. bis"'' and it was confused with a historic character, the cardinal deacon John son of Robert, who opposed Boniface VII after John XIV's death. Since John XV through XIX seemed to have neglected the existence of John XIV "bis", Pedro Julião "corrected" this error by taking the name John XXI. Since the error was discovered in the 19th century, the popes are now listed using the numbers they used during their reigns. There is no John XX. However, Popes John XV through XIX are dual-numbered XVI through XX because some sources had already used the altered numbering sequence. John XXI is also dual-numbered XX in older works.
John XXIII
During the Western Schism, there were two claimants to the papacy. The Council of Pisa tried to end the schism by electing Alexander V as pope. However, neither the Avignon pope nor the Roman pope was willing to abdicate, so there were now three papal claimants. The Pisan pope Alexander V was succeeded by John XXIII, who abdicated in 1415 as part of a deal to end the schism. Until the mid-20th century, the Annuario Pontificio regarded the Roman line as legitimate until 1409, followed by the Pisan line until 1415. The last three popes of the schism were listed as Gregory XII, Alexander V, and John XXIII. However, the Western Schism was reinterpreted when Pope John XXIII chose to reuse the ordinal XXIII, citing "twenty-two Johns of indisputable legitimacy." This is reflected in modern editions of the Annuario Pontificio, which extend Gregory XII's reign to 1415. The Pisan popes Alexander V and John XXIII are now considered to be antipopes.