#include <bits/stdc++.h>
using namespace std;
void newline() { cout << endl; }
template <typename T>
void display(T input) {
  cout << input;
}
template <typename T>
void put(T input) {
  display(input);
  newline();
}
deque<string> v;
int solve() {
  int cnt = 0;
  bool r = false, l = false;
  string prev = v.front();
  v.pop_front();
  while (!v.empty()) {
    string now = v.front();
    v.pop_front();
    if (prev == "lu" && now == "ru" || prev == "ru" && now == "lu") {
      cnt++;
    }
    if (prev == "ld" && now == "rd" || prev == "rd" && now == "ld") {
      cnt++;
    }
    prev = now;
  }
  return cnt;
}
int main() {
  ios::sync_with_stdio(false);
  int n;
  while (cin >> n && n) {
    for (int i = 0; i < n; i++) {
      string s;
      cin >> s;
      v.push_back(s);
    }
    put(solve());
  }
}
