I've found that different species will school together if they're the same approximate size. Normally, in a 40g tank, I would say you could do 18-20 corydoras, especially if they were the only type of fish in the tank. If you have other fish in the tank, the number of corydoras should decrease accordingly. However, corydoras spend 99% of their time at the bottom of the tank, and a hex tank has much less area at the bottom that a standard 40g, or 40g breeder tank, so probably half that number. Another consideration is your tank height. Corydoras likes to come to the surface for a gulp of air several times daily. The deeper the water, the more difficult it is for them to reach the surface. If they're unable to get to air frequently, they'll literally drown. I would advise against keeping them in a tall tank like a hex; or, at least, keeping your water level only 2/3 full.