What determines the number of shares the company has to sell in an IPO?the money they need?

Lets say a company(400,000 shares) wants to raise $1 million by selling half of the company(200,000 shares). would each share cost 5$?
If the same company wants to mainatin 70% of it’s shares(280,000) by selling only 120,000 shares, would each share cost $8.333?
This is my understaing of IPOs, so please if something wrong please tell me.
thank you
lithium
I didn’t understand?on what basis?































