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

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

int calc(int[] xs) {
    int ans = 0;
    int p = 1;
    while (p < xs.length) {
        if (xs[p-1] == xs[p]) {
            ans++;
            p += 2;
        }
        else p++;
    }
    return ans;
}

void main() {
    readint;
    auto xs = readints;

    int ans = calc(xs);
    writeln(ans);
}