A farm has a total of 30 goats and pigs. The number of goats is half the number of pigs. How many pigs are there?

p + 0.5p = 30

1.5p = 30

p = 20