#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int MM[500], FF[500];
int main() {
  ios::sync_with_stdio(0);
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    char g;
    int from, to;
    cin >> g >> from >> to;
    int *v;
    if (g == 'M')
      for (int i = from; i <= to; i++) MM[i]++;
    else
      for (int i = from; i <= to; i++) FF[i]++;
  }
  int MAX = 0;
  for (int i = 1; i < 400; i++) MAX = max(MAX, min(MM[i], FF[i]) * 2);
  cout << MAX;
  return 0;
}
