Evolutionary dynamics of recent selection on cognitive abilities