Your basis is your cost (the purchase price).
You would subtract your basis from the selling price less sales expenses (which would be the real estate commission but not the mortgage).
Further, you cannot deduct interest or property taxes you paid in past tax years unless you elected to capitalize those expenses (which cannot be done after the fact).