Is this Optimization function right?

A real estate developer is contemplating the construction of a luxury condominium building.

Profit per unit is expected to be $200,000 if 20 units are built, but will decrease by $4000 for

each additional unit built on the site. How many units should be built in order to maximize

total profit?

For some reason i find these problems very tricky. So, is this function right for profit?:

Price per unit = 200000 - ((x-20) 4000)

Profit = x(200000 - ((x-20) 4000))

Thanks!