#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)

int main() {
	int N;
	cin>>N;
	vector<int> a(N);
	int ans = 0;
	rep(i,N)cin>>a[i];
	rep(i,N-1){
		if(a[i] == a[i+1]){
			ans++;
			a[i+1] = 0;
		}
	}
	cout<<ans<<endl;
}