CiOw is not actually the number of cities owned. Rather, it is increased by 1 every time a city is built by the player, and is decreased by 1 every time a city owned by the player is destroyed. It is also reduced by 1 when a city is disbanded (for any cities processed after the city that was disbanded). CiOw does not change when cities are captured or lost. Finally, CiOw is set to the number of cities currently owned by the player each turn, after all the cities are processed. Essentially, if you capture cites, you will get a turn of production without them adding to your unhappiness; but if you lose cities they will still contribute to your unhappiness during your next turn’s production.