#include <bits/stdc++.h>
using namespace std;
int main(void) {
  while (true) {
    int n;
    char str[150 * 4 + 1];
    scanf("%d", &n);
    fgets(str, sizeof(str) / sizeof(char), stdin);
    int left = 0, right = 0;
    int ans = 0;
    int current = 0;
    if (n == 0) {
      return 0;
    }
    for (int i = 0; i < 3 * n; i = i + 3) {
      if (str[i] == 'l') {
        left = 1 - left;
      }
      if (str[i] == 'r') {
        right = 1 - right;
      }
      if (left == right && left != current) {
        ans++;
        current = 1 - current;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
