#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
const double eps = 1e-10;
const double pi = acos(-1.0);
const int inf = 0x3f3f3f3f;
const long long linf = 1e18;
const int N = 1e6 + 10;
int n, a[N];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    a[i]--;
  }
  int ans = 0;
  for (int i = 0; i < n - 1; i++) {
    if (a[i] == a[i + 1]) {
      swap(a[i], a[i + 1]);
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
