Investors & landlords

I bought a new house and moved into that house in March. I continued to make mortgage & interest payments on my (empty) previous house until it sold, in September of that year. Can I deduct mortgage interest on both homes during the months when my house was still on the market? or only on the house I was living in?