Nontaxable 1099 Misc

I have a 1099  misc for getting a refund on legal fees. I paid my bill and had a issue with the legal firm. They credited their services and refunded me 18,000 of what I previously paid. I entered the 18000 as income, which shows on Sch 1, part 1 on line z. How do I get it to show on part 2 on line z to zero this transaction. Or is there a better way of doing this?  Thank you for your help/