Sayyiduna Samurah bin Jundub (may Allah be pleased with him) says: The Messenger of Allah (peace and blessings be upon him) ordered us that if the time of prayer came upon us while we were three or more, we should put one of us forward to be the imam, and if we were two, we should both form a row together.
Hadith Referenceالمعجم الكبير للطبراني / باب السين / 6986