#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (1) {
    cin >> n;
    if (!n) break;
    string f;
    int a = 0, b = 0, c = 0, d = 0;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      cin >> f;
      if (f == "lu") a = 1;
      if (f == "ru") b = 1;
      if (f == "ld") c = 1;
      if (f == "rd") d = 1;
      if (ans % 2 == 0 && a == 1 && b == 1) {
        ans += 1;
        a = 0, b = 0, c = 0, d = 0;
      }
      if (ans % 2 == 1 && c == 1 && d == 1) {
        ans += 1;
        c = 0, d = 0, a = 0, b = 0;
      }
    }
    cout << ans << endl;
    ans = 0;
  }
}
