An equilibrium model of city size