But we have built so many enduring systems that rely on bad apples to function the way the do. See "insurance pricing", "private prisons", and "justice enforcement". In the real world, the ideal number of jails or homeless people is neither zero nor "all of them".
Obviously the ideal number of jails is not zero, but why wouldn't the ideal number of homeless people be zero?
How old are those systems in their present configuration?
In the real world the jails are for holding, the prisons are for convicted criminals and the homeless people (most of them anyway, because not everybody that is homeless is derelict, and the addicts) get whatever help they need. Because we actually can afford it.
What is the ideal number of unhoused people? And how do you arrive at that number?
I think the ideal number of _prisons_ (as distinct from jails / pretrial confinement) is zero.
This whole charade in the USA of dressing up slavery (without even a single day of interruption on January 31, 1865) as "correction" is absurd. It's obviously a way to continue an economy that relies on a supply of involuntary labor, and has nothing whatsoever to do with public safety.
There are plenty of ways to implement restorative justice which are superior to forcing convicts to make starbucks uniforms (start here if you've never delved into this, but there are great books on the topic which you can find from here: https://harvardpolitics.com/restorative-justice-abolition/).
The ideal number of jails and homeless people is zero.
Obviously you will not reach that literally. That's why it is an ideal number, not a real number. It is still a good and worthy goal.
Finnland for example has nearly eradicated homelessness. It is not literally zero but 0.08% which is pretty good.
You can also reduce the crime rate dramatically by better social security, education, easier access to mental health care and so many other things.
And don't say we can't afford these things. These measures pay dividends in building a better society for everyone. What we can't afford is having so many billionaires not paying their fair share.