#include <bits/stdc++.h>
using namespace std;
void solve() {
  int flag[2] = {0};
  int n;
  while (cin >> n, n) {
    int point = 0;
    for (int i = 0; i < n; ++i) {
      string s;
      cin >> s;
      if (s == "lu") {
        flag[0] = 1;
      } else if (s == "ld") {
        flag[0] = 2;
      } else if (s == "ru") {
        flag[1] = 1;
      } else if (s == "rd") {
        flag[1] = 2;
      }
      if ((flag[0] == 1 && flag[1] == 1) || (flag[0] == 2 && flag[1] == 2)) {
        ++point;
        flag[0] = 0;
        flag[1] = 0;
      }
    }
    cout << point << endl;
  }
}
int main() {
  solve();
  return (0);
}
