Answer: 170 HES and 90 XOM
Hi! Let's say you bought A HES shares, and B XOM shares. As you invested $22,240, yo have that:
(80 and 96 are the initial prices)
3 months later those prices decreased to 64 and 80, and you sold your shares at those prices, then:

This is a system of two linear equations and two unkowns A, B. You can solve it getting A from first equation:

And then replacing A into the second equation you can find the value of B. Then replacing B in the third equation you get A.