Growing up in a large social group makes Australian magpies more intelligent, new research shows.
Using four tasks to test intelligence, scientists from the University of Exeter and the University of Western Australia found wild Australian magpies from larger groups showed "elevated cognitive performance".
The study also found more intelligent females produced more offspring.
The research suggests that the demands of living in complex social groups may play a role in the evolution of intelligence.
"Australian magpies - from Western Australia, where we conducted our research - live in stable social groups," said Dr Alex Thornton, of the Centre for Ecology and Conservation on the University of Exeter's Penryn Campus in Cornwall.
"We showed that individuals living in larger groups in the wild show elevated cognitive performance, which in turn is linked to increased reproductive success.
"Repeated testing of juveniles at different ages showed that the link between group size and intelligence emerged in early life."
Researchers examined 14 wild groups of Australian magpies (Western Australian subspecies Cracticus tibicen dorsalis) in Perth, ranging in size from three to 12 birds.
Cognitive ability of each magpie was tested using four tasks, including one in which they had to learn to associate a particular colour with the presence of food, a memory task where food was hidden in the same place many times.
There was also a test of self-control, in which magpies had to stop themselves from pecking directly at the food through the transparent barrier and instead had to go round to the sides of the tube to get the food.
Lead researcher Dr Ben Ashton, from the University of Western Australia, said: "The challenges of living in complex social groups have long been thought to drive cognitive evolution.
"However, evidence to support this is contentious, and has recently been called into question."
He added: "Our results suggest that the social environment plays a key role in the development of cognition.
"They also suggest that females who do well in cognitive tasks have more offspring, indicating there is the potential for natural selection to act on cognition.
"Together, these results support the idea that the social environment plays an important role in cognitive evolution."
The paper, published in the journal Nature, is entitled: "Cognitive performance is linked to group size and affects fitness in Australian magpies."