while True:
    n = input()

    if n == 0:
        break

    s = raw_input().split()

    isLeftDown = True
    isRightDown = True
    isDown = True

    cnt = 0
    for i in range(n):
        if s[i] == "lu":
            isLeftDown = False
        elif s[i] == "ld":
            isLeftDown = True
        elif s[i] == "ru":
            isRightDown = False
        elif s[i] == "rd":
            isRightDown = True

        if isLeftDown == False and isRightDown == False and isDown == True:
            cnt += 1
            isDown = False
        if isLeftDown == True and isRightDown == True and isDown == False:
            cnt += 1
            isDown = True

    print cnt