#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int s = 0, h = 0;
  for (int i = 0; i < n; i++) {
    string a;
    cin >> a >> a;
    if (a[0] == 's')
      s++;
    else
      h++;
  }
  if (s < h) swap(s, h);
  int p = ceil(sqrt(s * 2));
  while (p % 2 == 0 && (p - 1) * (p - 1) / 2 + 1 >= s &&
         (p - 1) * (p - 1) / 2 >= h)
    p--;
  cout << p;
}
