#include <bits/stdc++.h>
int main() {
  int n;
  int i;
  int cnt;
  char s[100][3];
  int left, right;
  int up, down;
  char c;
  while (scanf("%d", &n), n) {
    for (i = 0; i < n; i++) {
      scanf("%s", s[i]);
    }
    left = 0;
    right = 0;
    up = 0;
    down = 0;
    cnt = 0;
    for (i = 0; i < n; i++) {
      switch (s[i][0]) {
        case 'l':
          if (s[i][1] == 'u') {
            left = 1;
            up = 1;
            if (right * up) {
              cnt++;
              left = 0;
              up = 0;
            }
          } else if (s[i][1] == 'd') {
            left = 1;
            down = 1;
            if (right * down) {
              cnt++;
              left = 0;
              down = 0;
            }
          }
          break;
        case 'r':
          if (s[i][1] == 'u') {
            right = 1;
            up = 1;
            if (left * up) {
              cnt++;
              right = 0;
              up = 0;
            }
          } else if (s[i][1] == 'd') {
            right = 1;
            down = 1;
            if (left * down) {
              cnt++;
              right = 0;
              down = 0;
            }
          }
          break;
        default:
          cnt = 100;
          break;
      }
    }
    printf("%d\n", cnt);
  }
  return 0;
}
