Start with what you paid, what you sold for and which costs count. Then check whether the primary residence rules apply.