#include <bits/stdc++.h>
using namespace std;
int main() {
  while (1) {
    int n;
    cin >> n;
    if (n == 0) break;
    string x;
    int count = 0, check = 0;
    for (int i = 0; i < n; i++) {
      cin >> x;
      if (x == "lu") {
        if (check == 0)
          check = 1;
        else if (check = 2) {
          check = 3;
          count++;
        }
      }
      if (x == "ru") {
        if (check == 0) check = 2;
        if (check == 1) {
          check = 3;
          count++;
        }
      }
      if (x == "ld") {
        if (check == 3) check = 2;
        if (check == 1) {
          check = 0;
          count++;
        }
      }
      if (x == "rd") {
        if (check == 3) check = 1;
        if (check == 2) {
          check = 0;
          count++;
        }
      }
    }
    cout << count << endl;
  }
  return 0;
}
