#include <bits/stdc++.h>
const double PI = acos(-1);
const double ESP = 1e-10;
using namespace std;
int main() {
  int n;
  while (cin >> n, n) {
    int co = 0, co1 = 0;
    for (int i = 0; i < n; i++) {
      string s;
      cin >> s;
      if (s[0] == 'l')
        co++;
      else
        co1++;
    }
    cout << min(co, co1) << endl;
  }
}
