It was narrated from Abu Hurairah that the Prophet (ﷺ) said:
"When the call for the prayer is given, the Shaitan takes to his heels, passing wind loudly so that he will not hear the call to prayer. When the call to prayer is finished, he comes back. And when the Iqamah is said, he again takes to his heels, and after it is completed, he returns again to interfere between the (praying) person and his heart, saying to him: 'Remember such and such, remember such and such,' - things that he had not remembered - until he does not know how many (Rak'ahs) he has prayed."
أَخْبَرَنَا قُتَيْبَةُ، عَنْ مَالِكٍ، عَنْ أَبِي الزِّنَادِ، عَنِ الأَعْرَجِ، عَنْ أَبِي هُرَيْرَةَ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ ‏ "‏ إِذَا نُودِيَ لِلصَّلاَةِ أَدْبَرَ الشَّيْطَانُ وَلَهُ ضُرَاطٌ حَتَّى لاَ يَسْمَعَ التَّأْذِينَ فَإِذَا قُضِيَ النِّدَاءُ أَقْبَلَ حَتَّى إِذَا ثُوِّبَ بِالصَّلاَةِ أَدْبَرَ حَتَّى إِذَا قُضِيَ التَّثْوِيبُ أَقْبَلَ حَتَّى يَخْطِرَ بَيْنَ الْمَرْءِ وَنَفْسِهِ يَقُولُ اذْكُرْ كَذَا اذْكُرْ كَذَا لِمَا لَمْ يَكُنْ يَذْكُرُ حَتَّى يَظَلَّ الْمَرْءُ إِنْ يَدْرِي كَمْ صَلَّى ‏"‏ ‏.‏
GradeSahih (Darussalam)
English reference : Vol. 1, Book 7, Hadith 671
Arabic reference : Book 7, Hadith 678