Auto-translated
The idea arose to create a specialist for Haven, a hero who can "upgrade" his troops by changing their level after battle: n warriors of level k are upgraded to level k+1 (levels, like in retraining, are 1. Peasant -> 2. Archer -> 3. Swordsman -> 4. Monk -> 5. Knight), and n is somehow tied to the number of enemy warriors killed (I think a logarithm would be best), while k increases with the hero's level. I can't come up with suitable formulas.