#include <iostream>

using namespace std;

int main() {
	int n;
	cin >> n;

	int a = 0, t, count = 0;
	cin >> t;
	for (int i = 1; i < n; ++i) {
		cin >> a;
		if (a == t) {
			++count;
			t = 0;
		} else {
			t = a;
		}
	}
	
	cout << count << endl;
}