this was on a math test and I figured out the answer but not how to form a algebraic expression to solve it.

A farmer has chickens and pigs that total 28. There are a total of 72 Legs.
How many pigs does he have?

Use an algebraic expression to find the answer.

I could not for the life of me figure out any sort of expression for this and I took the test last thursday and it still bugs me. I blame my teacher throwing us a curve ball.