#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
int ls = 0;
int rs = 0;
bool check() {
  if (ls == 0 && rs == 0) return true;
  if (ls == 1 && rs == 1) return true;
  return false;
}
int main() {
  while (1) {
    int n;
    cin >> n;
    if (n == 0) break;
    long long int cnt = 0;
    bool ok = false;
    for (int i = 0; i < (int)(n); i++) {
      string tmp;
      cin >> tmp;
      if (tmp == "lu" && ls == 0) {
        ls = 1;
        if (ok == false && check()) {
          cnt++;
          ok = true;
        }
      }
      if (tmp == "ru" && rs == 0) {
        rs = 1;
        if (ok == false && check()) {
          cnt++;
          ok = true;
        }
      }
      if (tmp == "ld" && ls == 1) {
        ls = 0;
        if (ok == false && check()) {
          cnt++;
          ok = true;
        }
      }
      if (tmp == "rd" && rs == 1) {
        rs = 0;
        if (ok == false && check()) {
          cnt++;
          ok = true;
        }
      }
      ok = check();
    }
    cout << cnt << endl;
  }
}
