import java.lang.Exception

fun main(args:Array<String>?): Unit {
    while(true) {
        val n = readLine()!!.trim().toInt()
        if (n == 0) return
        val step = readLine()!!.trim().split(' ').map {
            when (it) {
                "lu" -> Step.LU
                "ru" -> Step.RU
                "ld" -> Step.LD
                "rd" -> Step.RD
                else -> throw Exception()
            }
        }
        println(countGrossStep(step))
    }

}
fun countGrossStep(steps: List<Step>): Int {
    var result = 0
    var current = State.OnFloor() as State
    for (step in steps){
        val next = current.step(step)
        if (current.changeState(next)) ++result
        current = next
    }
    return result
}

sealed class State {
    abstract fun step(step: Step): State
    fun changeState(that: State): Boolean {
        return (this is OnBoard && that is OnFloor) || (this is OnFloor && that is OnBoard)
    }
    data class OnBoard(val left: Boolean, val right: Boolean): State() {
        constructor():this(true, true)
        override fun step(step: Step): State {
            return when(step){
                Step.LU -> OnBoard(true, right)
                Step.RU -> OnBoard(left, true)
                Step.LD -> if (right) OnBoard(false, true) else OnFloor()
                Step.RD -> if (left) OnBoard(true, false) else OnFloor()
            }
        }
    }
    data class OnFloor(val left: Boolean, val right: Boolean): State() {
        constructor():this(true, true)
        override fun step(step: Step): State {
            return when(step){
                Step.LU -> if (right) OnFloor(false, true) else OnBoard()
                Step.RU -> if (left) OnFloor(true, false) else OnBoard()
                Step.LD -> OnFloor(true, right)
                Step.RD -> OnFloor(left, true)
            }
        }
    }
}
enum class Step {
    LU, RU, LD, RD
}
