Abu Hurairah reported,

The Messenger of Allah ﷺ said, "When the call to prayer is made, Satan turns and flees, passing wind so that he does not hear the adhan. When the adhan is finished, he returns. When the iqamah is called, he flees again, and when the iqamah is completed, he returns and comes between a man and his own thoughts, saying, 'Remember this and that,' reminding him of things he had not been thinking about, until the man no longer knows how much he has prayed. So if any of you does not know how much he has prayed, whether three or four, let him perform two prostrations while seated."

Azami 2470

Sahih

عن أبي هريرة قال

قال رسول الله ﷺ: إذا نودي بالصلاة أدبر الشيطان وله ضراط حتى لا يسمع الأذان، فإذا قضي الأذان أقبل، فإذا ثوب بها أدبر، فإذا قضي التثويب أقبل حتى يخطر بين المرء ونفسه، يقول: أذكر كذا وكذا- ما لم يكن يذكر- حتى يظل الرجل إن يدري كم صلى، فإذا لم يذر أحدكم كم صلى- ثلاثا أو أربعا-فليسجد سجدتين وهو جالس.

الأعظمي 2470صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Prayer
Chapter
Forgetfulness
Section
Two prostrations for forgetfulness and building upon certainty
Numbering
Jami al-Kamil 2470 (2nd edition)
Azami 2470