#include <bits/stdc++.h>
using namespace std;
int f[1 << 17][200];
int rr[1 << 17], rb[1 << 17];
int sumr, sumb;
int n, maxn;
bool c[20];
int r[20], b[20];
int read() {
  int ans = 0, flag = 1;
  char ch = getchar();
  while ((ch > '9' || ch < '0') && ch != '-') ch = getchar();
  if (ch == '-') flag = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') ans = ans * 10 + ch - '0', ch = getchar();
  return ans * flag;
}
int main() {
  n = read();
  maxn = ((1 + n) * n) / 2;
  for (int i = 1; i <= n; i++) {
    char ch = getchar();
    if (ch == 'R') c[i] = 1;
    r[i] = read(), b[i] = read();
    sumr += r[i], sumb += b[i];
  }
  for (int i = 0; i < (1 << n) - 1; i++)
    for (int j = 1; j <= n; j++) {
      if (i & (1 << (j - 1))) continue;
      if (c[j])
        rr[i | 1 << (j - 1)] = rr[i] + 1, rb[i | 1 << (j - 1)] = rb[i];
      else
        rr[i | 1 << (j - 1)] = rr[i], rb[i | 1 << (j - 1)] = rb[i] + 1;
    }
  memset(f, -1, sizeof(f));
  f[0][0] = 0;
  for (int i = 0; i < (1 << n) - 1; i++) {
    for (int j = 0; j <= maxn; j++) {
      if (f[i][j] == -1) continue;
      for (int k = 1; k <= n; k++) {
        if (i & (1 << (k - 1))) continue;
        int sr = min(rr[i], r[k]), sb = min(rb[i], b[k]);
        f[i | (1 << (k - 1))][j + sr] =
            max(f[i | (1 << (k - 1))][j + sr], f[i][j] + sb);
      }
    }
  }
  int res = max(sumr, sumb);
  for (int i = 0; i <= maxn; i++)
    if (f[(1 << n) - 1][i] != -1)
      res = min(res, max(sumr - i, sumb - f[(1 << n) - 1][i]));
  printf("%d\n", res + n);
  return 0;
}
