It isn’t easy to say exactly how many. Church history is often rather murky, and it can be hard to distinguish between abdication and deposition – look, for example, at Silverius, who, I think, was arrested by Belisarius and sent off for trial before the Emperor. Here is a list of those who immediately come to mind.
Pontian (230-235) is the first Pope know to have abdicated. He did this after he had been sentenced to forced labour in the mines during one of the Roman persecutions of Christianity.
Marcellinus (296 – 304) committed apostasy when bullied by the authorities into offering worship to the Emperor. He may then have abdicated.
Silverius (536 – 537) was deposed and exiled by the empress Theodora, then taken to Constantinople to stand trial for treason, convicted, and forced by his successor, Pope Vigilius, to abdicate again.
John XVIII (1003 – 1009) may have voluntarily abdicated.
Benedict IX (11th century) served as Pope three times: he was elected, ejected, returned, abdicated, deposed, returned again, ejected again, and eventually excommunicated.
Celestine V (1294) refused to act as a puppet of Charles II of Sicily, and abdicated after only 5 months.
Gregory XII (1406 – 1417) was one of the more entertaining Renaissance Popes. Though not entirely willing, he abdicated in order to heal a long schism in the Church
John XXIII (1410-1415) was probably the most entertaining of the Renaissance Popes, though there is some doubt whether he was legally the Pope. Gibbon says of him when he was brought to trial: “The most scandalous charges were suppressed; the vicar of Christ was only accused of piracy, murder, rape, sodomy, and incest.”
I suppose the current successor of Saint Peter is not in the best company.