A firm's total cost and marginal cost functions are TC = 5 Q2 + 4 Q - 2 and MC = 10 Q + 4. Assume that the market price is 24 and that the marginal revenue (MR) is also 24 at all output levels. How much output does the firm have to produce to maximize profits?