At a local movie theater, the relationship between the number of tickets sold, $$x$$, and the total revenue, $$R$$ (in dollars), can be expressed by the equation:
$$R = 10x - 0.5x^2$$
Where the ticket price is $10, and the theater experiences a loss of $0.50 for every ticket sold beyond 20 tickets due to operational costs. If the theater wants to maximize its revenue, how many tickets should it sell?