As many as you can feed
. On a new tank with relatively fresh live rock a dozen or so would be fine.
On an established tank with lots of LR
, loads of algae (some good, some bad), a moderate fish load (which adds their food scraps / detritus) - You could go to 1 or 1.5 per gallon.
50 or 100 hermits sound like alot - until you see them in a baggie. Most are quite small and once they are dispersed thru the tank it really doesn't seem like that much.