#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int j = 0;
  vector<int> index;
  while (true) {
    int count = 0;
    int state = 1;
    cin >> index[j];
    cout << index[j] << endl;
    if (index[j] == 0) {
      break;
    } else if (index[j] == 1) {
      cout << count << endl;
      continue;
    }
    vector<string> a;
    string str = "";
    for (int i = 0; i < index[j]; i++) {
      cin >> str;
      a.push_back(str);
    }
    for (int i = 0; i < index[j]; i++) {
      if (!a[i].compare("lu") && state == 1) {
        if (!a[i + 1].compare("ru")) {
          count++;
          state = 0;
        }
      }
      if (!a[i].compare("ru") && state == 1) {
        if (!a[i + 1].compare("lu")) {
          count++;
          state = 0;
        }
      }
      if (!a[i].compare("ld") && state == 0) {
        if (!a[i + 1].compare("rd")) {
          count++;
          state = 1;
        }
      }
      if (!a[i].compare("rd") && state == 0) {
        if (!a[i + 1].compare("ld")) {
          count++;
          state = 1;
        }
      }
    }
    cout << count << endl;
    j++;
  }
  return 0;
}
