#include<iostream>

using namespace std;

int main(){
  int n;
  cin >> n;
  int a[n];
  int b = 0;
  int cnt = 0;
  for(int i=0;i<n;i++){
    cin >> a[i];
    if(a[i] == b){
      cnt++;
      b = 0;
    }else{
      b = a[i];
    }
  }
  cout << cnt << endl;
}