#include <bits/stdc++.h>
using namespace std;
const int INF = (1 << 30);
const double EPS = (1e-10);
int main() {
  int n;
  string o;
  bool on = false, l_on = false, r_on = false;
  while (true) {
    cin >> n;
    if (n == 0) break;
    int up_or_down = 0;
    for (int i = 0; i < n; ++i) {
      cin >> o;
      if (o == "lu") {
        l_on = true;
        if ((!on) && r_on) {
          on = true;
          ++up_or_down;
        }
      } else if (o == "ru") {
        r_on = true;
        if ((!on) && l_on) {
          on = true;
          ++up_or_down;
        }
      } else if (o == "ld") {
        l_on = false;
        if (on && (!r_on)) {
          on = false;
          ++up_or_down;
        }
      } else {
        r_on = false;
        if (on && (!l_on)) {
          on = false;
          ++up_or_down;
        }
      }
    }
    cout << up_or_down << endl;
  }
}
