Do you need to invest only the gain amount or entire sale value of house property to save tax?

If a house property is sold within 24 months from the date of purchase, the gain amount, if any, is considered as Short-Term Capital Gain (STCG) and added to total income of the seller.