while ( n = gets.to_i ) != 0
	l = r = p = false
	res = 0
	gets.split.each do | w |
		if w[0] == 'l'
			l ^= true
		elsif
			r ^= true
		end

		if l == r && l != p
			p ^= true
			res += 1
		end
	end
	puts res
end