#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXN = 17;
const int MAXS = (1 << MAXN) + 7;
const int MAXD = MAXN * MAXN;
int n;
int type[MAXN], va[MAXN], vb[MAXN];
int dp[MAXS][MAXD];
bool used[MAXN];
void init();
void input();
void work();
int main() {
  init();
  input();
  work();
}
void init() { ios::sync_with_stdio(false); }
void input() {
  scanf("%d", &n);
  char ch[10];
  for (int i = 0; i < n; ++i) {
    scanf("%s%d%d", ch, &va[i], &vb[i]);
    if (ch[0] == 'R')
      type[i] = 0;
    else
      type[i] = 1;
  }
}
void work() {
  int cc[2] = {0};
  int ca = 0, cb = 0;
  for (int i = 0; i < n; ++i) ca += va[i], cb += vb[i];
  memset(dp, -1, sizeof(dp));
  dp[0][0] = 0;
  int ms = 1 << n, md = n * n, vs, nd, nxt;
  for (int sta = 0; sta < ms; ++sta) {
    for (int i = 0; i < n; ++i) used[i] = ((sta & (1 << i)) > 0);
    cc[0] = cc[1] = 0;
    for (int i = 0; i < n; ++i)
      if (used[i]) ++cc[type[i]];
    for (int dec = 0; dec <= md; ++dec) {
      if (dp[sta][dec] ^ -1) {
        for (int i = 0; i < n; ++i) {
          if (!used[i]) {
            vs = sta | (1 << i);
            nd = dec + (((cc[0]) < (va[i])) ? (cc[0]) : (va[i]));
            nxt = dp[sta][dec] + (((cc[1]) < (vb[i])) ? (cc[1]) : (vb[i]));
            dp[vs][nd] = (((dp[vs][nd]) > (nxt)) ? (dp[vs][nd]) : (nxt));
          }
        }
      }
    }
  }
  int ans = INF, now;
  for (int i = 0; i < md; ++i) {
    if (dp[ms - 1][i] ^ -1) {
      now =
          (((ca - i) > (cb - dp[ms - 1][i])) ? (ca - i) : (cb - dp[ms - 1][i]));
      ans = (((ans) < (now)) ? (ans) : (now));
    }
  }
  printf("%d\n", ans + n);
}
