#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  while (cin >> n && n > 0) {
    string move;
    int lpos[200];
    int rpos[200];
    int res = 0;
    lpos[0] = 0;
    rpos[0] = 0;
    for (int i = (int)(0); i < (int)(n); i++) {
      cin >> move;
      lpos[i + 1] = lpos[i];
      rpos[i + 1] = rpos[i];
      (move[0] == 'l' ? lpos[i + 1] : rpos[i + 1]) = (move[1] == 'u');
      if (i > 0 && lpos[i + 1] == rpos[i + 1] && lpos[i - 1] == rpos[i - 1] &&
          lpos[i + 1] != lpos[i - 1]) {
        res++;
      }
    }
    cout << res << endl;
  }
  return 0;
}
