#include <bits/stdc++.h>
int dx4[][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
int dx8[][2] = {{0, 1}, {0, -1}, {1, 1},  {1, -1},
                {1, 0}, {-1, 0}, {-1, 1}, {-1, -1}};
using namespace std;
vector<int> male(400);
vector<int> female(400);
int main(int argc, char *argv[]) {
  int n;
  scanf("%d", &n);
  ;
  for (int i = 0; i < n; i++) {
    string x;
    int a, b;
    cin >> x >> a >> b;
    if (x[0] == 'F') {
      female[a]++;
      female[b + 1]--;
    } else {
      male[a]++;
      male[b + 1]--;
    }
  }
  long long ans = 0;
  for (int i = 1; i < 400; i++) {
    male[i] = male[i] + male[i - 1];
    female[i] += female[i - 1];
    ans = (ans > (male[i] < female[i] ? (male[i]) : (female[i]))
               ? (ans)
               : ((male[i] < female[i] ? (male[i]) : (female[i]))));
  }
  cout << 2 * ans << endl;
  return 0;
}
