Count Integers Appearing in a Single Block
Mark each place where a value starts a new run; values that start exactly one run are the ones whose copies sit together.
Mark each place where a value starts a new run; values that start exactly one run are the ones whose copies sit together.