while 1:
    n = input()
    if n == 0:
        break
    F = raw_input().split()
    mode = 1
    s = [0,0]
    ans = 0
    for f in F:
        if f[0]=="l":
            s[0]^=1
            if mode != s[0]:
                mode = -1
        else:
            s[1]^=1
            if mode != s[1]:
                mode = -1
        if s[0]==s[1]:
            if mode == s[0]:
                ans += 1
            mode = s[0]^1
    print ans