In 1990 David purchased land for $100,000. In 1996 he takes out a nonrecourse mortgage on the land for $30,000. In 2012 he sells the land for $50,000 and the buyer takes over the mortgage, which was $25,000. David paid commissions of $2,000. How much gain or loss did David have on the sale in 2012?