#import <Foundation/Foundation.h>
int main() {
	int n;
	scanf("%d",&n);
	int prev = 0;
	int current = 0;
	int ans = 0;
	for(int i=0;i<n;i++){
		int a;
		scanf("%d",&a);
		if(prev==a){
			current++;
		}else{
			ans += current/2;
			current = 1;
		}
		prev = a;
	}
	ans += current/2;
	printf("%d\n",ans);
}