Below is an instruction that describes a task. Write a response that appropriately completes the request in English. Please answer in English.

### Instruction:
Adam had a farm with animals. He had 12 cows and twice as many sheep. He decided to buy 3 pigs for every sheep he had. How many animals were on the farm after the transaction?

### Response:
Adam had 12 cows and 2x sheep. 
3 pigs for every sheep is 3x where x is the number of sheep. 
12 cows + 2x sheep + 3x pigs = total number of animals
12 + 2x + 3x = total number of animals
5x = total number of animals - 12
5x = total number of animals - 12
x = (total number of animals - 12) / 5
x = (total number of animals - 12) / 5

#### (total number of animals - 12) / 5

