#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a = 0, count = 0;
  string s;
  for (int i = 1; i <= n; i++) {
    cin >> s;
    if (s == "lu") a++;
    if (s == "ld") a--;
    if (s == "ru") a++;
    if (s == "rd") a--;
    if (a == 2 || a == -2) count++;
    if (i % 2 == 0) a = 0;
  }
  cout << count << endl;
  return 0;
}
