When Odysseus first leaves Troy, he has twelve ships in his possession. Unfortunately for him and his crew, these ships do not manage to last very long in their epic journey to return home.
When Odysseus and his men arrive at the Laestrygonian city of Telepylus, chaos ensues. The party of Ithacans who were sent to scout out the hospitality of the city are attacked and mostly consumed. The two survivors race back to the ships in the harbor, but are followed by thousands of Laestrygonians who turn the harbor into a trap and hurl enormous rocks at the fleet.
As a result, eleven of the twelve ships are destroyed and sink in the harbor. It is only Odysseus's primary ship which manages to survive this attack.
Odysseus left Troy with twelve ships. This was seen during his conversation with Alcinous when Odysseus told his story about his travel after the war at Troy. Odysseus begins by telling Alcinous about his encounters with Calypso and Circe, goddesses who wanted marriage but whom he resisted. He then tells him of his voyage from Troy to Ismarus, city of Cicons, where they plundered the town until they were repulsed. They proceeded with their journey, but Zeus punished them by setting them off course. They instead arrived at the land of the Lotus eaters, then at the land of the Cyclopes. It is at the land of the Cyclopes that the number of ships is explicitly mentioned. This happened when Odysseus and his men went hunting wild goats, bringing back nine goats for each of his eleven ships except for his, which got ten goats, bringing the total number of ships on his voyage to twelve.
“Heaven sent us excellent sport; I had twelve ships with me, and each ship got nine goats.”
When Odysseus begins to tell his story to the king and queen of Phaecaia, Alcinous and Arete, he tells them that when he left Troy after the end of the war, he commanded twelve ships. As he continues to share the tale of his journey, the number of ships will diminish.