The long-run competitive equilibrium price equals the minimum average total cost.
We find the quantity produced by each firm at the minimum average cost by solving the first-order condition
$$
\frac{\mathrm d AC(q)}{\mathrm d q}=-1+0.04q=0\quad\Longrightarrow\quad q=25
$$
Then plug this quantity into the average total cost equation to get the equilibrium price:
$$
P=AC(25)=300-25+0.02\times (25)^2=287.5
$$
At this price, the quantity demanded in the market is
$$
D(287.5)=642,000−36\times 287.5=631,650
$$
So, the number of firms is
$$
N=\frac{\text{market output}}{\text{firm output}}=\frac{631,650}{25}=25,266
$$