#include <bits/stdc++.h>
using namespace std;
int r[1200], b[1200], totr, totb, p[1200], f[1 << 16][140], all;
int n, m, ans = 0x7fffffff, costr, costb, cr, cb;
char type[3];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s%d%d", type + 1, &r[i], &b[i]);
    if (type[1] == 'R') p[i] = 1;
    totr += r[i];
    totb += b[i];
  }
  m = n * (n + 1) / 2;
  all = (1 << n) - 1;
  memset(f, -1, sizeof(f));
  f[0][0] = 0;
  for (int i = 0; i < 1 << n; i++) {
    for (int j = 0; j <= m; j++)
      if (~f[i][j]) {
        cr = cb = 0;
        for (int k = 0; k < n; k++)
          if (i & 1 << k) {
            if (p[k])
              cr++;
            else
              cb++;
          }
        for (int k = 0; k < n; k++) {
          if (i & 1 << k) continue;
          costr = min(r[k], cr);
          costb = min(b[k], cb);
          f[i | 1 << k][j + costr] =
              max(f[i | 1 << k][j + costr], f[i][j] + costb);
        }
      }
  }
  for (int j = 0; j <= m; j++)
    if (~f[all][j]) ans = min(ans, max(totr - j, totb - f[all][j]));
  printf("%d\n", ans + n);
  return 0;
}
