#include <bits/stdc++.h>
using namespace std;
bitset<65000000> f;
long long m[200995];
vector<long long> z;
map<long long, long long> u;
map<long long, long long> u1;
map<string, int> v;
string w[200008];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long t, b, c, d, e, f, g, h = 0, i, j, k, l;
  char a;
  cin >> t;
  while (t--) {
    cin >> a >> b >> c;
    if (a == 'M') {
      for (i = b; i <= c; i++) u[i]++;
    } else if (a == 'F') {
      for (i = b; i <= c; i++) u1[i]++;
    }
    for (i = 0; i <= 400; i++) {
      g = min(u[i], u1[i]);
      h = max(h, g);
    }
  }
  cout << 2 * h << endl;
  return 0;
}
