#include <bits/stdc++.h>
using namespace std;
const int maxn = 1 << 16;
int dp[maxn][2][16 * 16 + 1], n, ed, c[20], r[20], b[20], ans = 0x3f3f3f3f, rb,
                                                          rr;
int main() {
  cin >> n;
  getchar();
  for (int i = 0; i < n; i++) {
    char ch;
    cin >> ch >> r[i + 1] >> b[i + 1];
    if (ch == 'R')
      c[i + 1] = 0;
    else
      c[i + 1] = 1;
    if (r[i + 1] > n) {
      rr += (r[i + 1] - n);
      r[i + 1] = n;
    }
    if (b[i + 1] > n) {
      rb += (b[i + 1] - n);
      b[i + 1] = n;
    }
  }
  ed = (1 << n) - 1;
  memset(dp, -1, sizeof(dp));
  dp[0][0][0] = 0;
  dp[0][1][0] = 0;
  for (int i = 0; i <= ed; i++) {
    int nr = 0, nb = 0;
    for (int t = 0; t < n; t++)
      if (i & (1 << t)) {
        if (c[t + 1])
          nb++;
        else
          nr++;
      }
    for (int j = 0; j < 2; j++)
      for (int k = 0; k <= n * n; k++) {
        if (dp[i][j][k] == -1) continue;
        for (int cc = 0; cc < n; cc++) {
          if (i & (1 << cc)) continue;
          int next = (i | (1 << cc));
          int nrr, nbb, rmr = j == 0 ? 0 : k, rmb = j == 1 ? 0 : k;
          nrr = max(r[cc + 1] - rmr - nr, 0);
          nbb = max(b[cc + 1] - rmb - nb, 0);
          int need = max(nrr, nbb);
          int rrr = rmr + need - max(r[cc + 1] - nr, 0),
              bbb = rmb + need - max(b[cc + 1] - nb, 0);
          int pos = rrr == 0 ? 0 : 1, rs = rrr == 0 ? bbb : rrr;
          if (dp[next][pos][rs] == -1)
            dp[next][pos][rs] = dp[i][j][k] + need;
          else
            dp[next][pos][rs] = min(dp[next][pos][rs], dp[i][j][k] + need);
        }
        if (i == ed) {
          int rmr = j == 0 ? 0 : k, rmb = j == 1 ? 0 : k;
          int wr = max(rr - rmr, 0), wb = max(rb - rmb, 0);
          ans = min(ans, dp[i][j][k] + max(wr, wb));
        }
      }
  }
  cout << ans + n << endl;
  return 0;
}
