:wa:
If you join the imam before Ruku or during ruku of any rakat, then you can count that Rakat.
The procedure is, stand in the row with the intention of joining the imam in prayer, and say Takbeer Tahreemah (Allahu Akbar). Then proceed to follow the imam in whatever position he is.
After the Imam completes his prayer by saying Salam, say Allahu Akbar and stand up and complete your missed rakat.