#include <bits/stdc++.h>
using namespace std;
const int N = 16 * 16, M = 1 << 16, T = 16;
int dp[M][N];
int cost[T][2];
int type[T];
int main() {
  int n, i;
  char c;
  cin >> n;
  int rsum = 0, bsum = 0;
  for (i = 0; i < n; ++i) {
    cin >> c;
    cin >> cost[i][0] >> cost[i][1];
    rsum += cost[i][0];
    bsum += cost[i][1];
    if (c == 'R')
      type[i] = 0;
    else
      type[i] = 1;
  }
  memset(dp, -1, sizeof(dp));
  dp[0][0] = 0;
  for (int bit = 0; bit < (1 << n); ++bit) {
    int r = 0, b = 0;
    for (i = 0; i < n; ++i) {
      if (bit & (1 << i)) {
        if (type[i] == 0)
          ++r;
        else
          ++b;
      }
    }
    for (int cc = 0; cc < N; ++cc) {
      if (dp[bit][cc] == -1) continue;
      for (i = 0; i < n; ++i) {
        if (!(bit & (1 << i))) {
          int na = min(cost[i][0], r);
          int nb = min(cost[i][1], b);
          dp[bit | (1 << i)][cc + na] =
              max(dp[bit | (1 << i)][cc + na], dp[bit][cc] + nb);
        }
      }
    }
  }
  int lim = (1 << n) - 1;
  int ret = 1e9;
  for (i = 0; i < N; ++i)
    if (dp[lim][i] != -1) {
      ret = min(ret, max(rsum - i, bsum - dp[lim][i]));
    }
  cout << n + ret << endl;
}
