First figure out how many cookies Jose got rid of. So firstly there would be those 5 that he ate, and then 21 that he gave to his friends (each friend got 3 cookies, so 7x3 is 21 cookies). Add 21 and 5 to get 26. Since he got rid of 26 cookies, but subtract 26 from 54 to get the number of cookies Jose has left:
54-26 = 28
Thus, Jose has 28 cookies left.