Ali (RAA) narrated that the Messenger of Allah (ﷺ) said:
"When a group of people passes by, it is sufficient if one of them gives a salutation, and it is sufficient for those who are sitting that one of them replies." Related by Ahmad and Al-Baihaqi. (FR)
English reference (FR): Book 16, Hadith 1488 (FR)
Arabic reference (FR): Book 16, Hadith 1444 (FR)