Ibn ‘Abbas reported the Prophet as saying, "The best number of companions is four, the best number in expeditions four hundred, and the best number in armies four thousand; and twelve thousand will not be overcome through smallness of numbers."
Tirmidhi, Abu Dawud and Darimi transmitted it, Tirmidhi saying this is a gharib tradition.