#include <bits/stdc++.h>
using namespace std;
int main() {
  for (int n; cin >> n, n;) {
    int cur = 0, prev = 0, ans = 0;
    while (n--) {
      string f;
      cin >> f;
      cur =
          f[1] == 'u' ? (cur | 1 << (f[0] == 'l')) : (cur & 0 << (f[0] == 'l'));
      if ((cur ^ prev) == 3) ans++, prev = cur;
    }
    cout << ans << endl;
  }
}
