You are given an array . Each entry is one of , , , and .
In one operation, choose an index with and simultaneously replace and by
respectively. Both new values are calculated from the values before the operation. Here and are the usual bitwise operations.
An array is stable if applying the operation at any valid index leaves the array unchanged.
Find the minimum number of operations needed to obtain a stable array. You may perform zero operations.
One operation changes to .
One operation changes to .
Three operations suffice: becomes , then , then .
Three operations suffice: becomes , then , then .