#! /usr/bin/env python
# -*- coding: utf-8 -*-

N = int(raw_input())
while N!=0:
    act = raw_input().split()
    cur = 0
    cnt = 0
    lr = [0, 0]

    for i in range(N):
        if act[i] == "ld":
            lr[0] = 0
        elif act[i] == "lu":
            lr[0] = 1
        elif act[i] == "ru":
            lr[1] = 1
        elif act[i] == "rd":
            lr[1] = 0 

        if lr == [1, 1] and cur == 0:
            cur = 1
            cnt += 1
        elif lr == [0, 0] and cur == 1:
            cur = 0
            cnt += 1

    print cnt
    N = int(raw_input())