#include <bits/stdc++.h>
using namespace std;
int INF = (1LL << 30) - 1;
int MOD = 1e9 + 7;
int main() {
  int N;
  cin >> N;
  while (N) {
    int flag = 0, used = 0, cnt = 0;
    for (int i = int(0); i < int(N); ++i) {
      string s;
      cin >> s;
      if (!flag) {
        if (s == "lu") used |= 2;
        if (s == "ru") used |= 1;
      } else {
        if (s == "ld") used |= 2;
        if (s == "ld") used |= 1;
      }
      if (used == 3) {
        used = 0;
        flag = !flag;
        cnt++;
      }
    }
    cout << cnt << endl;
    cin >> N;
  }
}
