import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;

void main() {
  int n;
  readf (" %d", &n);
  auto a = new int[n];
  foreach (t; 0 .. n) { 
    readf (" %d", &a[t]);
  }
  int last = a[0];
  int res;
  foreach (i; 1 .. n) {
    if (a[i] == last) {
      last = int.max;
      ++res;
    } else {
      last = a[i];
    }
  }
  writeln (res);
}
