#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 l = 0, r = 0;
    for (int i = 0; i < n; ++i) {
      string str;
      cin >> str;
      if (str == "lu") {
        if (r == 1 && state == 0) {
          cnt++;
          state = 1;
        } else {
          l = 1;
        }
      }
      if (str == "ru") {
        if (l == 1 && state == 0) {
          cnt++;
          state = 1;
        } else {
          r = 1;
        }
      }
      if (str == "ld") {
        if (r == 0 && state == 1) {
          cnt++;
          state = 0;
        } else {
          l = 0;
        }
      }
      if (str == "rd") {
        if (l == 0 && state == 1) {
          cnt++;
          state = 0;
        } else {
          r = 0;
        }
      }
    }
    cout << cnt << endl;
  }
  return 0;
}
