#include <bits/stdc++.h>   using namespace std;   const int inf = 0x3f3f3f3f;   int n;   int a[10001], c[10001], d[10001];   int ans = 0;   char str[101];   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %s , str);       if (str[0] ==  M ) a[i] = 1;       scanf( %d %d , &c[i], &d[i]);     }     for (int i = 1; i <= 366; i++) {       int x = 0, y = 0;       for (int j = 1; j <= n; j++) {         if (c[j] <= i && i <= d[j]) {           if (a[j])             ++x;           else             ++y;         }       }       ans = max(ans, min(x, y));     }     printf( %d n , ans * 2);     return 0;   }   