#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 17;
int dp[MAX_N * MAX_N][1 << MAX_N];
struct card {
  char c;
  int r, b;
};
card a[MAX_N];
int n;
int sumR, sumB;
const int inf = -1e9;
int main() {
  scanf("%d", &n);
  int MAXR = n * n;
  for (int i = 0; i < n; i++) {
    char s[2];
    scanf("%s %d %d", s, &a[i].r, &a[i].b);
    a[i].c = s[0];
    sumR += a[i].r;
    sumB += a[i].b;
  }
  for (int i = 0; i <= MAXR; i++) {
    for (int mask = 0; mask < (1 << n); mask++) {
      dp[i][mask] = inf;
    }
  }
  dp[0][0] = 0;
  for (int mask = 0; mask < (1 << n) - 1; mask++) {
    int cntR = 0;
    int 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 < MAXR; sr++) {
      if (dp[sr][mask] == inf) {
        continue;
      }
      for (int i = 0; i < n; i++) {
        if (!(mask & (1 << i))) {
          int nxtR = sr + min(a[i].r, cntR);
          int nxtB = dp[sr][mask] + min(a[i].b, cntB);
          dp[nxtR][mask | (1 << i)] = max(dp[nxtR][mask | (1 << i)], nxtB);
        }
      }
    }
  }
  int res = -inf;
  for (int sr = 0; sr <= MAXR; sr++) {
    res = min(res, max(sumB - dp[sr][(1 << n) - 1], sumR - sr));
  }
  printf("%d", res + n);
  return 0;
}
