Sunan an-Nasa'i, Book 13, Hadith 58 (Nasa'i 1238)

It was narrated from Imran bin Husain that:

The Prophet (ﷺ) led them in prayer and forgot (how many rak'ahs he had prayed), then he prostrated twice, then he said the salam.