#include <bits/stdc++.h>
int main() {
  int n, lr, ud, ans;
  char buf[5];
  while (scanf("%d", &n) && n > 0) {
    ans = 0, lr = 0, ud = 1;
    while (n-- > 0) {
      scanf("%s", buf);
      if (*buf == 'l')
        lr |= 1;
      else if (*buf == 'r')
        lr |= 2;
      if (*(buf + 1) == 'u' && ud == 1) {
        if (lr == 3) ans++, lr = 0, ud = 0;
      } else if (*(buf + 1) == 'd' && ud == 0) {
        if (lr == 3) ans++, lr = 0, ud = 1;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
