The amount that is not deductible is the amount, if any, by which the total of your contributions to an RRSP during the 89-day period just before your withdrawal from that RRSP, is more than the fair market value of that RRSP after your withdrawal.
If both you and your spouse or common-law partner contributed to the RRSP during the 89-day period just before your spouse or common-law partner's withdrawal under the HBP or LLP, the earliest contributions made during this period are the non-deductible contributions.