In a farm, there are cows, chickens, and ducks. The number of legs was 22 more than twice the number of heads. Find the number of cows if the total number of chickens and ducks was two times the number of cows. Each cow has 4 legs, each chicken has 2 legs, and each duck has 2 legs.