#include <iostream>

using namespace std;

int n;
int u;

int main() {
	cin >> n;
	int p = -1;
	int c = 0;
	for (int i = 1; i <= n; i++) {
		int x;
		cin >> x;
		if (x == p) {
			c++;
		} else {
			u += c/2;
			c = 1;
		}
		p = x;
	}
	u += c/2;
	cout << u << "\n";
}
