In a group of buffaloes and ducks, the number of legs is 24 more than twice the number of heads. What is the number of buffaloes?