The evolution of intergroup tolerance in nonhuman primates and humans