#include <bits/stdc++.h>
using namespace std;
int n;
string f[100];
vector<int> ans_list;
int main() {
  while (true) {
    cin >> n;
    if (n == 0) break;
    for (int i = 0; i < n; i++) {
      cin >> f[i];
    }
    int ans = 0;
    int mode = 0;
    for (int i = 0; i < n; i++) {
      if (f[i] == "lu" && f[i + 1] == "ru") {
        ans++;
        i++;
      } else if (f[i] == "ru" && f[i + 1] == "lu") {
        ans++;
        i++;
      } else if (f[i] == "ld" && f[i + 1] == "rd") {
        ans++;
        i++;
      } else if (f[i] == "rd" && f[i + 1] == "ld") {
        ans++;
        i++;
      } else {
        i++;
      }
    }
    ans_list.push_back(ans);
  }
  for (int i = 0; i < ans_list.size(); i++) {
    cout << ans_list[i] << endl;
  }
  return 0;
}
