A step decrements every bag element and increments every rule entry. When an element reaches 0 it is removed and the first rule is merged into the bag with parity: an integer already in the bag is removed rather than added. The program halts when the bag or the rules run out.