Does "2 out of 5 previous years" include primary (or sole) residency by ex-spouse?

If a couple who already divorced have the non-owning ex-spouse as the primary (or sole) resident of the house, then does that count as "2 out of the 5 previous years" when it comes to determining capital gains tax on the sale?