Acquisition and functional consequences of social knowledge in macaques