´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.
Hadith ReferenceSunan an-Nasa'i / The Book of Forgetfulness (In Prayer) / Hadith: 1237
Hadith Gradingالألبانی:صحيح | زبیر علی زئی:إسناده صحيح