#include <bits/stdc++.h>
int main(void) {
  int i = 0, j, k;
  int n[100] = {0};
  int counter[100] = {0};
  char str[100][301];
  int right[300] = {0};
  int left[300] = {0};
  int state[100] = {0};
  while (1) {
    scanf("%d%*c", &n[i]);
    if (n[i] != 0) {
      gets(str[i]);
    } else {
      break;
    }
    i++;
  }
  for (j = 0; j < i; j++) {
    for (k = 0; k < n[j] * 3; k += 3) {
      if (str[j][k] == 'l') {
        left[j]++;
      } else
        right[j]++;
      if (right[j] % 2 == 0 && left[j] % 2 == 0 && state[j] % 2 == 1) {
        counter[j]++;
        state[j]++;
      } else if (right[j] % 2 == 1 && left[j] % 2 == 1 && state[j] % 2 == 0) {
        counter[j]++;
        state[j]++;
      }
    }
    printf("%d\n", counter[j]);
  }
  return 0;
}
