#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s[100];
  while (cin >> n, n) {
    for (int i = 0; i < n; i++) cin >> s[i];
    int ans = 0;
    for (int i = 0; i < n; i += 2) {
      if (s[i][1] == s[i + 1][1]) ans++;
    }
    cout << ans << endl;
  }
  return 0;
}
