#include <bits/stdc++.h>
using namespace std;

int main(){
    int n;
    scanf("%d", &n);

    int arr[n+1];

    for(int i = 0; i < n; i++)
        scanf("%d", &arr[i]);

    int change = 0;

    for(int i = 1; i < n; i++){
        if(arr[i] == arr[i-1]){
            arr[i] = -1;
            change++;
        }
    }

    printf("%d\n", change);

    return 0;
}
