#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    if (n == 0) return 0;
    bool up = true;
    bool r = false, l = false;
    int ans = 0;
    for (int i = (0); i < (n); ++i) {
      string s;
      cin >> s;
      if (up) {
        if (s[1] == 'u') {
          r |= s[0] == 'r';
          l |= s[0] == 'l';
        }
      } else {
        if (s[1] == 'd') {
          r |= s[0] == 'r';
          l |= s[0] == 'l';
        }
      }
      if (r && l) {
        ans++;
        r = false;
        l = false;
        up ^= 1;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
