import std.stdio, std.string, std.conv, std.algorithm, std.numeric;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

void main() {
    while (true) {
        int n;
        scan(n);

        if (!n) return;

        auto a = readln.split;

        if (n&1) {
            n--;
            a.popBack;
        }

        int ans;

        foreach (i ; 0 .. n/2) {
            ans += (a[2*i] == "lu" && a[2*i + 1] == "ru" || a[2*i] == "ru" && a[2*i+1] == "lu"
                    || a[2*i] == "ld" && a[2*i+1] == "rd" || a[2*i] == "rd" && a[2*i+1] == "ld");
        }

        writeln(ans);
    }
}



void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}