#include <bits/stdc++.h>
using namespace std;
using LL = long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1000000000;
const double PI = acos(-1);
int main() {
  int n;
  string s[1000];
  while (cin >> n && n) {
    for (int i = 0; i < n; i++) {
      cin >> s[i];
    }
    int ans = 0;
    for (int i = 0; i < n; i += 2) {
      if ((s[i] == "lu" && s[i + 1] == "ru") ||
          (s[i] == "ru" && s[i + 1] == "lu") ||
          (s[i] == "ld" && s[i + 1] == "rd") ||
          (s[i] == "rd" && s[i + 1] == "ld"))
        ans++;
    }
    cout << ans << endl;
  }
}
