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