The Prophet (ﷺ) led them in prayer and forgot (how many rak'ahs he had prayed), then he prostrated twice, then he said the salam.
Sunan an-Nasa'i Book 13, Hadith 58