import std.stdio, std.algorithm, std.string, std.conv, std.array, std.range, std.math;
int read() { return readln.chomp.to!int; }
int[] reads() { return readln.split.to!(int[]); }

void main() {
    int n = read();
    int[] a = reads();

    int ans;
    foreach (i; 1..n) {
        if (a[i-1] == a[i]) {
            a[i] = a[i-1]-10002;
            ans++;
        }
    }
    writeln(ans);
}