#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:30777216")
using namespace std;
long long n, k, m, p;
long long mod = 1000000007;
long long ans = 0;
int main() {
  long long x, y;
  cin >> n;
  vector<long long> m(400), g(400), ans_m(400), ans_g(400);
  for (int i = 0; i < n; i++) {
    string s;
    long long x, y;
    cin >> s >> x >> y;
    if (s[0] == 'M') m[x]++, m[y + 1]--;
    if (s[0] == 'F') g[x]++, g[y + 1]--;
  }
  for (int i = 1; i < 400; i++) {
    m[i] = m[i - 1] + m[i];
    g[i] = g[i - 1] + g[i];
  }
  for (int i = 0; i < 400; i++) {
    ans_m[i] = min(m[i], g[i]);
  }
  ans = 0;
  for (int i = 0; i < 400; i++) {
    if (ans < ans_m[i]) ans = ans_m[i];
  }
  cout << ans * 2;
  return 0;
}
