I would appreciate advice on how to perform the following COUNTIF function:

For a vector only containing ones and zeros, that is a dummy variable, I need to count the number of ones (TRUE) followed by a one (TRUE), the number of zeros (FALSE) followed by a zero (FALSE), etc.

In some kind of noob terms this would be:

```
sum(MyVector[i+1] == MyVector[i])
OR
sum(if(MyVector[i] == 1 & MyVector[i + 1] == 1))
```