#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
bool debug = false;
int main() {
  int n;
  string s[105];
  bool up = false;
  while (cin >> n) {
    if (n == 0) break;
    up = false;
    int cnt = 0;
    for (int i = 0; i < int(n); i++) cin >> s[i];
    for (int i = 0; i < n; i += 2) {
      if (!up && ((s[i] == "lu" && s[i + 1] == "ru") ||
                  (s[i] == "ru" && s[i + 1] == "lu"))) {
        up = true;
        cnt++;
      } else if (up && ((s[i] == "ld" && s[i + 1] == "rd") ||
                        (s[i] == "rd" && s[i + 1] == "ld"))) {
        up = false;
        cnt++;
      }
    }
    cout << cnt << endl;
  }
  return 0;
}
