Update count logic.