#include <bits/stdc++.h>
using namespace std;
static const int INF = 1e9;
static const double PI = acos(-1.0);
static const double EPS = 1e-10;
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}
inline int BITS_COUNT(unsigned long long int b) {
  int c = 0;
  while (b != 0) {
    c += (b & 1);
    b >>= 1;
  }
  return c;
}
inline int MSB(unsigned long long int b) {
  int c = 0;
  while (b != 0) {
    ++c;
    b >>= 1;
  }
  return c - 1;
}
inline int MAKE_MASK(unsigned long long int upper,
                     unsigned long long int lower) {
  assert(lower < 64 && upper < 64 && lower <= upper);
  return ((assert((!numeric_limits<typeof(upper)>::is_signed)),
           assert(upper < 64), (1ULL << (upper))) -
          1) ^
         ((assert((!numeric_limits<typeof(lower)>::is_signed)),
           assert(lower < 64), (1ULL << (lower))) -
          1);
}
template <typename T1, typename T2>
ostream& operator<<(ostream& s, const pair<T1, T2>& d) {
  return s << "(" << d.first << ", " << d.second << ")";
}
template <typename T>
ostream& operator<<(ostream& s, const complex<T>& d) {
  return s << "(" << d.real() << ", " << d.imag() << ")";
}
inline double now() {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  return (static_cast<double>(tv.tv_sec) +
          static_cast<double>(tv.tv_usec) * 1e-6);
}
inline vector<string> split(string s, char delimiter) {
  vector<string> v;
  string t;
  for (typeof(s.length()) i = (0); i < (s.length()); ++i) {
    if (s[i] == delimiter)
      v.push_back(t), t = "";
    else
      t += s[i];
  }
  v.push_back(t);
  return v;
}
inline string join(vector<string> s, string j) {
  string t;
  for (typeof(s.size()) i = (0); i < (s.size()); ++i) {
    t += s[i] + j;
  }
  return t;
}
complex<int> dydx4[4] = {complex<int>(-1, 0), complex<int>(0, 1),
                         complex<int>(1, 0), complex<int>(0, -1)};
complex<int> dydx8[8] = {complex<int>(-1, 0), complex<int>(0, 1),
                         complex<int>(1, 0),  complex<int>(0, -1),
                         complex<int>(-1, 1), complex<int>(1, 1),
                         complex<int>(1, -1), complex<int>(-1, -1)};
int g_height, g_width;
bool in_field(complex<int> p) {
  return (0 <= p.real() && p.real() < g_height) &&
         (0 <= p.imag() && p.imag() < g_width);
}
bool opt_debug = false;
int main(int argc, char** argv) {
  std::ios_base::sync_with_stdio(false);
  int __c;
  while ((__c = getopt(argc, argv, "d")) != -1) {
    switch (__c) {
      case 'd':
        opt_debug = true;
        break;
      default:
        abort();
    }
  }
  enum { UP, DOWN };
  enum { LEFT, RIGHT };
  enum { LU, RU, LD, RD };
  int n;
  while (cin >> n, n) {
    int count = 0;
    vector<int> legs(2, DOWN);
    for (typeof(n) _ = (0); _ < (n); ++_) {
      int prev_state = DOWN;
      int move;
      string str;
      cin >> str;
      if (str == "lu") {
        move = LU;
      } else if (str == "ru") {
        move = RU;
      } else if (str == "ld") {
        move = LD;
      } else if (str == "rd") {
        move = RD;
      }
      switch (move) {
        case LU:
          legs[LEFT] = UP;
          break;
        case RU:
          legs[RIGHT] = UP;
          break;
        case LD:
          legs[LEFT] = DOWN;
          break;
        case RD:
          legs[RIGHT] = DOWN;
          break;
      }
      if (legs[RIGHT] == UP && legs[LEFT] == UP && prev_state == DOWN) {
        count++;
        prev_state = UP;
      }
      if (legs[RIGHT] == DOWN && legs[LEFT] == DOWN && prev_state == UP) {
        count++;
        prev_state = DOWN;
      }
    }
    cout << count << endl;
  }
  return 0;
}
