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

def main():
  while True:
    n = input()
    if not n: break

    w = 0
    a = [0, 0]
    ans = 0
    for s in raw_input().split():
      f = 0 if s[0] == "l" else 1
      u = 0 if s[1] == "d" else 1
      a[f] = u
      if w == 0 and a[0] == 1 and a[1] == 1:
        w = 1
        ans += 1
      elif w == 1 and a[0] == 0 and a[1] == 0:
        w = 0
        ans += 1

    print ans

  return 0

## -------------------------------------------
## TEMPLATE

if __name__ == "__main__":
  setrecursionlimit(1024 * 1024)
  main()