#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
  int n;
  while (cin >> n, n) {
    int ans = 0;
    int state = 1;
    bool right_ok = 0, left_ok = 0;
    for (int i = 0; i < n; i++) {
      string s;
      cin >> s;
      if (s == "lu") {
        if (state == 1) left_ok = 1;
      } else if (s == "ru") {
        if (state == 1) right_ok = 1;
      } else if (s == "ld") {
        if (state == 0) left_ok = 1;
      } else {
        if (state == 0) right_ok = 1;
      }
      if (state == 1) {
        if (right_ok && left_ok) {
          state = 0;
          right_ok = 0;
          left_ok = 0;
          ans++;
        }
      } else {
        if (right_ok && left_ok) {
          state = 1;
          right_ok = 0;
          left_ok = 0;
          ans++;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
