The Messenger of Allah ﷺ led one group in two units of prayer during the fear prayer, then gave the closing salutation. He then led the other group in two units, then gave the closing salutation. So the Prophet ﷺ prayed four units in total.
أخبرنا محمد بن عبد الأعلى وإسمعيل بن مسعود واللفظ له قالا حدثنا خالد عن أشعث عن الحسن
أن رسول الله ﷺ صلى بالقوم في الخوف ركعتين ثم سلم ثم صلى بالقوم الآخرين ركعتين ثم سلم فصلى النبي ﷺ أربعا