Cut resistance of a list Background

Define a run in a list as a maximal contiguous subsequence of identical values. For example, the list

0 0 0 1 1 0 3 3 3 2 2


has five runs of lengths 3, 2, 1, 3, 2 respectively. (Think of run-length encoding.)

Then define a cut operation as removing one item from each run of a list. Applied to the list above, the result will be 0 0 1 3 3 2.

Finally, the cut resistance of a list is the number of cut operations needed to reduce it to an empty list. The cut resistance of the list above is 3:

0 0 0 1 1 0 3 3 3 2 2
0 0 1 3 3 2
0 3
(empty)


Note that the cut resistance can be higher than the maximal run length, since multiple runs may fuse in the way:

1 0 0 1 1 0 0 1 0 0 1 0 0 1 0 1 0
0 1 0 0 0
0 0
0
(empty)


Related OEIS sequence: A319416 (cut resistance of n written in binary)

Task

Given a (possibly empty) list of nonnegative integers, compute its cut resistance.

Standard code-golf rules apply. The shortest code in bytes wins.

Test cases

0 0 0 1 1 0 3 3 3 2 2 =&gt; 3
1 0 0 1 1 0 0 1 0 0 1 0 0 1 0 1 0 =&gt; 4
1 2 3 4 5 99 100 101 =&gt; 1
4 4 4 4 4 4 3 3 3 3 2 2 1 2 2 3 3 3 3 4 4 4 4 4 4 =&gt; 7
(empty) =&gt; 0
J, 20 bytes

1-~&amp;#(#~2=/\_&amp;,)^:a:


Try it online!

Using the 0 0 0 1 1 0 3 3 3 2 2 example:


(......_&amp;,) Prepend infinity _:

_ 0 0 0 1 1 0 3 3 3 2 2

(..2=/....) Are consecutive pairs equal? Returns 0-1 list of same length as input:

_ 0 0 0 1 1 0 3 3 3 2 2  &lt;-- Before
 0 1 1 0 1 0 0 1 1 0 1   &lt;-- After

(#~.......) Apply the above mask as a filter to the input.  This drops the first member of every group:

0 0 1 3 3 2

^:a: Repeat until we reach a fixed point, returning all intermediate results (0-padded on the right):

0 0 0 1 1 0 3 3 3 2 2
0 0 1 3 3 2 0 0 0 0 0
0 3 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0

1-~&amp;# Subtract 1 from 1-~ the above result, after applying the "length of" verb to both lists &amp;#.  Since the length of 1 is 1, it remains unchanged, while the result above becomes 4:

4 - 1
3