move = {
	("000", "lu") : ("010", 0), ("000", "ru") : ("001", 0), 
	("010", "ld") : ("000", 0), ("001", "rd") : ("000", 0),
	("010", "ru") : ("111", 1), ("001", "lu") : ("111", 1),
	("111", "ld") : ("101", 0), ("111", "rd") : ("110", 0),
	("101", "lu") : ("111", 0), ("110", "ru") : ("111", 0),
	("101", "rd") : ("000", 1), ("110", "ld") : ("000", 1)
	}
while 1:
	n = int(raw_input())
	if n == 0:
		break
	f = raw_input().split(" ")
	status = "000"
	count = 0
	for foot in f:
		status, result = move[(status,foot)]
		count += result
	print count