#include <bits/stdc++.h>
using namespace std;
struct element {
  char c;
  int r, b;
};
const int MAX_N = 16;
const int inf = -MAX_N * 10000007;
int dp[(1 << MAX_N) + 5][(MAX_N + 1) * (MAX_N + 5)];
vector<element> a;
int n;
int sumR = 0, sumB = 0;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    char c[2];
    int r, b;
    scanf("%s", c);
    scanf("%d %d", &r, &b);
    sumR += r;
    sumB += b;
    a.push_back((element){c[0], r, b});
  }
  for (int mask = 0; mask < (1 << n); mask++) {
    for (int i = 0; i <= n * n; i++) {
      dp[mask][i] = inf;
    }
  }
  dp[0][0] = 0;
  for (int mask = 0; mask < (1 << n); mask++) {
    int cntR = 0, cntB = 0;
    for (int i = 0; i < n; i++) {
      if ((mask & (1 << i))) {
        if (a[i].c == 'R') {
          cntR++;
        } else {
          cntB++;
        }
      }
    }
    for (int sr = 0; sr <= n * n; sr++) {
      if (dp[mask][sr] != inf) {
        for (int i = 0; i < n; i++) {
          if (!(mask & (1 << i))) {
            int nxtr = sr + min(a[i].r, cntR);
            int nxtb = dp[mask][sr] + min(a[i].b, cntB);
            dp[mask | (1 << i)][nxtr] = max(dp[mask | (1 << i)][nxtr], nxtb);
          }
        }
      }
    }
  }
  int res = -inf;
  for (int sr = 0; sr <= n * n; sr++) {
    res = min(res, max(sumR - sr, sumB - dp[(1 << n) - 1][sr]));
  }
  printf("%d", res + n);
  return 0;
}
