'use strict'
 
function main(arg) {
    let lines = arg.split("\n");
    let N = lines[0];
    let list = lines[1].split(" ").map(n=>parseInt(n));
    let diffs = 0;
  	
    let set = new Set(list);
  
  	if(set.size === 1) {
      console.log(N / 2);
      return;
    }
  
    for(let i=0; i<N-2; i++) {
        if(i > 1 && list[i] !== list[i-1] && list[i] !== list[i-2]) {
            diffs++;
            list[i] = list[i-2];
        }
        if(list[i] !== list[i+2] || list[i] == list[i-1]) {
            diffs++;
            list[i+2] = list[i];
        }
    }
    
    console.log(diffs);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
