Messenger of Allah ﷺ said, "When the call for prayer is made, Satan takes to his heels passing wind so that he may not hear the Adhan and when the call is finished he comes back, and when the Iqama is pronounced, Satan again takes to his heels, and when the Iqama is finished he comes back again and tries to interfere with the person and his thoughts and say, "Remember this and that (which he has not thought of before the prayer)", till the praying person forgets how much he has prayed. If anyone of you does not remember whether he has offered three or four rakʿat then he should perform two prostrations of Sahu while sitting. (Using translation from Bukhārī 1231)
عَنِ النَّبِيِّ ﷺ قَالَ إِذَا نُودِيَ بِالْأَذَانِ أَدْبَرَ الشَّيْطَانُ لَهُ ضُرَاطٌ حَتَّى لَا يَسْمَعَ الْأَذَانَ فَإِذَا قُضِيَ الْأَذَانُ أَقْبَلَ فَإِذَا ثُوِّبَ أَدْبَرَ وَإِذَا قُضِيَ التَّثْوِيبُ أَقْبَلَ حَتَّى يَخْطِرَ بَيْنَ الْمَرْءِ وَنَفْسِهِ فَيَقُولُ اذْكُرْ كَذَا اذْكُرْ كَذَا لِمَا لَمْ يَكُنْ يَذْكُرُ حَتَّى يَظَلَّ الرَّجُلُ إِنْ يَدْرِي كَمْ صَلَّى فَإِذَا لَمْ يَدْرِ أَحَدُكُمْ كَمْ صَلَّى ثَلَاثًا أَمْ أَرْبَعًا فَلْيَسْجُدْ سَجْدَتَيْنِ وَهُوَ جَالِسٌ