#include <bits/stdc++.h>
using namespace std;
int main() {
  while (1) {
    int n;
    cin >> n;
    if (n == 0) break;
    string str;
    int left = 1;
    int right = 1;
    ;
    int ans = 0;
    int pre_left = 1;
    int pre_right = 1;
    int now = 1;
    for (int i = 0; i < n; i++) {
      cin >> str;
      if (str == "lu") {
        left = -1;
        if (right == -1 and now) {
          ans++;
          now = -1;
        }
      } else if (str == "ld") {
        left = 1;
        if (right and now == -1) {
          ans++;
          now = 1;
        }
      } else if (str == "ru") {
        right = -1;
        if (left == -1 and now) {
          ans++;
          now = -1;
        }
      } else if (str == "rd") {
        right = 1;
        if (left and now == -1) {
          ans++;
          now = 1;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}
