Since we have the value for selling each shirt, the earnings that came from the hats sold and the total earnings we can complete equation using a linear equation in which the cost of each shirt will represent the slope and the y-intercept will be the earnings that came from the hats, like this:
then clear the equation for x in order to find how many shirts were sold