#include<cmath>
#include<cstring>
#include<iostream>
using namespace std;
int main(){
	long i,n,a[10005],b[10005],maxn=-213,sum=0;
	cin>>n;
	for(i=0;i<n;i++)cin>>a[i];
	for(i=0;i<n;i++){
		if(a[i]==a[i+1]){
			a[i+1]=0;
			sum++;
		}
	}
	cout<<sum;
}