The Messenger of Allah ﷺ said, "When one of you stands to pray, Satan comes to him and confuses him in his prayer until he no longer knows how much he has prayed. If any of you experiences this, let him perform two prostrations while seated."
أخبرنا قتيبة عن مالك عن ابن شهاب عن أبي سلمة
أن رسول الله ﷺ قال إن أحدكم إذا قام يصلي جاءه الشيطان فلبس عليه صلاته حتى لا يدري كم صلى فإذا وجد أحدكم ذلك فليسجد سجدتين وهو جالس
[Sahih] Narrated by Muslim, Book of Mosques, Chapter on Forgetfulness in Prayer and Sujud for It, hadith no. 389, after hadith no. 569, from Qutayba, and by Bukhari, Book of Forgetfulness, Chapter on Forgetfulness in Obligatory and Voluntary Prayer, hadith no. 1232, through the hadith of Malik with this same chain, and it is found in Muwatta (Yahya): 1/100, and in Kubra, hadith nos. 592 and 1175.