I'm interested in the number of groups of consecutive instances of a given value that occur in a column (a group being one or more consecutive instances of that value).
For the following example, the answer is 3:
x
o
x
x
o
o
o
x
For the example below, the answer would be 6:
o
x
x
x
x
x
o
o
o
x
o
x
o
x
x
o
o
o
o
x
x
o
x
The values are all in 1 column.