import sys,os

k = int(raw_input())
al = raw_input().split()

up = 0
sup = 0
cnt = 0
lu = False
ru = False

for a in al:
    if a == "lu":
        lu = True
    elif a == "ld":
        lu = False
    elif a == "ru":
        ru = True
    elif a == "rd":
        ru = False
    
    if lu and ru:
        up = 2
    elif lu and ru:
        up = 1
    else:
        up = 0

    if sup <> 1 and up <> 1:
        if sup <> up:
            cnt = cnt + 1

    sup = up

print cnt

