Profits from sale of secondary home

Hello everybody , need advice on how to deduct on Turbotax the mortgage of a house I sold last year . I received a 1099 from the title company that I sold the house for $340,000 and when I input this in my Turbotax it calculates it as full income/profit , but out of the 340 K the mortgage company got paid about 170 K so my actual profit is only 170 K .How do I set this up in Turbotax so that I don't get taxed at 340 please ?