Quorum sensing as a mechanism to harness the wisdom of the crowds