#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  char foot[100][2] = {};
  int i;
  while (1) {
    cin >> n;
    if (n == 0) break;
    int sum = 0;
    for (i = 0; i < n; i++) cin >> foot[i][0] >> foot[i][1];
    for (i = 1; i < n; i++) {
      if (foot[i - 1][0] == foot[i][0] && foot[i][0] == foot[i + 1][0])
        continue;
      if (foot[i - 1][0] != foot[i][0]) {
        sum++;
        i++;
      }
    }
    cout << sum << endl;
  }
}
