#include <bits/stdc++.h>
using namespace std;
int m, nmin, nmax;
int main() {
  int n;
  while (cin >> n, n) {
    int state = 0, cnt = 0;
    int lu = 0, ru = 0, ld = 0, rd = 0;
    for (int i = 0; i < n; ++i) {
      string str;
      cin >> str;
      if (str == "lu" && state == 0) {
        if (ru == 1) {
          cnt++;
          lu = 0;
          ru = 0;
          state = 1;
        } else {
          lu = 1;
        }
      }
      if (str == "ru" && state == 0) {
        if (lu == 1) {
          cnt++;
          lu = 0;
          ru = 0;
          state = 1;
        } else {
          ru = 1;
        }
      }
      if (str == "ld" && state == 1) {
        if (rd == 1) {
          cnt++;
          rd = 0;
          ld = 0;
          state = 0;
        } else {
          ld = 1;
        }
      }
      if (str == "rd" && state == 1) {
        if (ld == 1) {
          cnt++;
          rd = 0;
          ld = 0;
          state = 0;
        } else {
          rd = 1;
        }
      }
    }
    cout << cnt << endl;
  }
  return 0;
}
