Evolutionary foundations of aggregate-taking behavior