Looking at the next Musallee to determine how many rakaats one missed
Q: A person arrives late to the masjid and misses a number of rakats with the imam. When the imam says salam, he thus has a number of extra rakaat to make up. But he doesn’t remember how many. In order to find out, may he pray slowly and see how many extra rakaats the people around him do, since they joined the prayer at the same time as him?
A: It is permissible.
And Allah Ta’ala (الله تعالى) knows best.