#include <bits/stdc++.h>
using namespace std;
int main() {
  while (true) {
    int fl;
    cin >> fl;
    if (!fl) return 0;
    int re = 0;
    bool l, r = false;
    bool p = false;
    for (int fi = (0); fi < (fl); ++fi) {
      string fc;
      cin >> fc;
      if (fc == "lu") l = true;
      if (fc == "ld") l = false;
      if (fc == "ru") r = true;
      if (fc == "rd") r = false;
      if (l == r) {
        if (p != l) {
          re++;
          p = l;
        }
      }
    }
    cout << re << endl;
  }
}
