import std.stdio;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;
 
void main() {
    int N;
    string[] X;
    bool input() {
        scanf("%d\n", &N);
        if (N == 0) return false;
        X = readln.chomp.split(" ").array;
        return true;
    }
    void solve() {
        int l = 0, r = 0;
        int p = 0;
        int C = 0;
        foreach (i; 0 .. N) {
            if (X[i][0] == 'l') {
                l = !l;
            } else {
                r = !r;
            }
            if (l == !p && r == !p) {
                C++;
                p = l;
            }
        }
        C.writeln;
    }
    while (input) solve;
}