What does the number in red near to the "Defend" menu stand for?

Solution 1:

That number represents the number of mines and defeated heroes that are ready to be collected. The mines do not need to be full for this, they just need to have generated some. You can extract materials from mines/heroes by clicking on them.

Source