Subnet Mask Optimization

In network 164.40.0.0, we need 1045 subnets and 10 hosts/subnet.

How many subnet bits are needed?

How many host bits are needed?

What possible subnet mask would maximize the number of hosts per subnet?

What possible subnet mask would maximize the number of subnets?