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

void main()
{
	int n;
	while (n = readln.chomp.to!int, n) {
		auto x = readln.chomp.split;
		bool l, r, pl, pr, s = 1;
		int cnt;
		foreach (i; 0..n) {
			if (x[i] == "lu") {
				l = 1;
			} else if (x[i] == "ld") {
				l = 0;
			} else if (x[i] == "ru") {
				r = 1;
			} else  {
				r = 0;
			}
			if (l != pl || r != pr) {
				if (l == s && r == s) {
					cnt++;
					s = !s;
				}
			}
			pl = l;
			pr = r;
		}
		cnt.writeln;
	}
}