#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e10;
long long dp[(1 << 16)][256];
long long sr, sb;
long long r[20];
long long b[20];
char cl[20];
int n;
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> cl[i];
    cin >> r[i] >> b[i];
    sr += r[i];
    sb += b[i];
  }
  for (int i = 0; i < 256; ++i) {
    dp[0][i] = -INF;
  }
  dp[0][0] = 0;
  for (int i = 1; i < (1 << n); ++i) {
    for (int j = 0; j < 256; ++j) dp[i][j] = -INF;
    long long cr = 0;
    long long cb = 0;
    for (int j = 0; j < n; ++j)
      if ((i >> j) & 1) {
        if (cl[j] == 'R')
          ++cr;
        else
          ++cb;
      }
    for (int j = 0; j < 256; ++j) {
      for (int k = 0; k < n; ++k) {
        if ((i >> k) & 1) {
          if (cl[k] == 'R') {
            if (j < min(r[k], cr - 1)) continue;
            dp[i][j] = max(dp[i][j], dp[i ^ (1 << k)][j - min(r[k], cr - 1)] +
                                         min(b[k], cb));
          } else {
            if (j < min(r[k], cr)) continue;
            dp[i][j] = max(dp[i][j], dp[i ^ (1 << k)][j - min(r[k], cr)] +
                                         min(b[k], cb - 1));
          }
        }
      }
    }
  }
  long long ans = INF;
  for (int i = 0; i < 256; ++i) {
    ans = min(ans, max(sr - i, sb - dp[(1 << n) - 1][i]));
  }
  cout << ans + n << "\n";
  return 0;
}
