import Command._
import State.MovingUp_LeftDown_RightDown

object Main extends App {
  override def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    Iterator
      .continually(sc.nextInt())
      .takeWhile(_ != 0)
      .map(n =>
        for (x <- 1 to n) yield sc.next()
      ).map(solve).foreach(println)
  }

  def solve(input: Seq[String]): Int = input.map(Command(_)).foldLeft(MovingUp_LeftDown_RightDown(0):State) (_.nextState(_)).count
}

sealed trait Command

object Command {
  def apply(s: String): Command = s match {
    case "lu" => LeftUp
    case "ru" => RightUp
    case "ld" => LeftDown
    case "rd" => RightDown
  }

  case object LeftUp extends Command
  case object LeftDown extends Command
  case object RightUp extends Command
  case object RightDown extends Command
}

sealed trait State {
  val count:Int
  val nextState: Command => State
}

object State {
  case class MovingUp_LeftDown_RightDown(count:Int) extends State {
    override val nextState = {
      case LeftUp => MovingUp_LeftUp_RightDown(count)
      case RightUp => MovingUp_LeftDown_RightUp(count)
    }
  }
  case class MovingUp_LeftUp_RightDown(count:Int) extends State {
    override val nextState = {
      case LeftDown => MovingUp_LeftDown_RightDown(count)
      case RightUp => MovingDown_LeftUp_RightUp(count+1)
    }
  }
  case class MovingUp_LeftDown_RightUp(count:Int) extends State {
    override val nextState = {
      case RightDown => MovingUp_LeftDown_RightDown(count)
      case LeftUp => MovingDown_LeftUp_RightUp(count+1)
    }
  }
  case class MovingDown_LeftUp_RightUp(count:Int) extends State {
    override val nextState = {
      case RightDown => MovingDown_LeftUp_RightDown(count)
      case LeftDown => MovingDown_LeftDown_RightUp(count)
    }
  }
  case class MovingDown_LeftDown_RightUp(count:Int) extends State {
    override val nextState = {
      case RightDown => MovingUp_LeftDown_RightDown(count+ 1)
      case LeftUp => MovingDown_LeftUp_RightUp(count)
    }
  }
  case class MovingDown_LeftUp_RightDown(count:Int) extends State {
    override val nextState = {
      case LeftDown => MovingUp_LeftDown_RightDown(count+1)
      case RightUp => MovingDown_LeftUp_RightUp(count)
    }
  }
}