#include <bits/stdc++.h>
using namespace std;
vector<int> dx = {1, -1, 0, 0};
vector<int> dy = {0, 0, 1, -1};
int main() {
  while (1) {
    int n;
    cin >> n;
    if (n == 0) break;
    int l = 0;
    int r = 0;
    int ans = 0;
    for (int i = 0; i < n; i++) {
      string s;
      cin >> s;
      if (s == "lu") {
        l = 1;
      } else if (s == "ru") {
        r = 1;
      } else if (s == "ld") {
        l = -1;
      } else if (s == "rd") {
        r = -1;
      }
      if (l == r) {
        ans++;
        l = 0;
        r = 0;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
