Would you want the bad news first or the good news???
On cannot take an IRS loss deduction on the sale of your Primary Residence; as it was not owned for “investment” purposes. BUT there is a bright side, if you qualify:
In the ownership of a Primary Residence, you may exclude from profit up to $250,000.0k-if single or $500,000.0k-if married on the sale of a Primary Residence that you occupied for 2 out of 5 years.
As always, protect yourself; seek the advise of a Tax Professional.