#include<iostream>
using namespace std;
unsigned long long a,b,c,d=0,e[100001],f[100001];
int main(){
	cin>>a;
	for(long long i=0;i<a;i++){
		cin>>e[i];
	}
	for(long long i=0;i<a;i++){
		if(e[i+1]==e[i]&&e[i+1]==e[i+2]){
			e[i+1]=0;
			d++;
		}
		if(e[i+1]==e[i]&&e[i+1]!=e[i+2]){
			e[i]=0;
			d++;
		}		
	}
	cout<<d<<endl;
	return 0;
}