Investors & landlords

Now per my understanding I have to use a 1031 exchange company to buy a similar investment property and rent it out for 2 years before I can turn into primary residence.  Then I have to live there for 2 years and then I can sell it and take the benefit of Tax    Am I correct?