How to qualify for the $1,016,836 lifetime capital gains exemption