Deductions & credits

Is it 18/24 of the exclusion, or of the actual gain?