function Main(s){
  s = s.split("\n");
  var n = +s[0];
  var a = s[1].split(" ").map(a=>+a);
  var ans = 0;
  var x = a[0]
  var t = 1;
  for(var i = 1; i < n; i++){
    if(x !== a[i]){
      ans += t >> 1;
      x = a[i]; t = 1;
      }
    else t++;
  }
  ans += t >> 1;
  console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin","utf8"));