#include <bits/stdc++.h>
using namespace std;
int n, m[1000], f[1000];
int x, y;
char c;
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> c >> x >> y;
    if (c == 'F') {
      for (int j = x; j <= y; j++) f[j]++;
    } else
      for (int j = x; j <= y; j++) m[j]++;
  }
  int ret = 0;
  for (int i = 0; i < 1000; i++) {
    ret = max(ret, 2 * min(f[i], m[i]));
  }
  cout << ret << '\n';
  return 0;
}
