When I am praying, so that I will not forget how many rak‘ahs I have prayed, I count the number of rak‘ahs on my fingers. When I have prayed one rak‘ah, I clench one of my fingers, then when I pray a second rak‘ah I clench the second finger, and so on until the end of the prayer. Is that permissible or is it regarded as making too many movements which invalidate or spoil the prayer?.
There is nothing wrong with that, because it is a small movement and is nothing big. There is nothing wrong with clenching one or two fingers so as not to forget, and this is not moving too much. Rather it is something small that is in the interests of the prayer, so it is excused. End quote.
Shaykh ‘Abd al-‘Azeez ibn Baaz (may Allah have mercy on him).