#include <bits/stdc++.h>
using namespace std;
int rb[20], r[20], b[20], f[66666][305];
int main() {
  int n, sr, sb, i, j, k, news, nr, nb, ans, rr, bb;
  scanf("%d\n", &n);
  for (sr = sb = i = 0; i < n; i++) {
    scanf("%c%d%d\n", &rb[i], &r[i], &b[i]);
    sr += r[i];
    sb += b[i];
  }
  memset(f, -1, sizeof(f));
  f[0][0] = 0;
  for (i = 0; i < 1 << n; i++) {
    for (rr = bb = j = 0; j < n; j++)
      if ((1 << j) & i)
        if (rb[j] == 'R')
          rr++;
        else
          bb++;
    for (j = 0; j <= n * n; j++)
      if (f[i][j] != -1) {
        for (k = 0; k < n; k++)
          if (!((1 << k) & i)) {
            news = i | (1 << k);
            nr = j + r[k] - max(r[k] - rr, 0);
            nb = f[i][j] + b[k] - max(b[k] - bb, 0);
            f[news][nr] = max(f[news][nr], nb);
          }
      }
  }
  ans = 1e9;
  for (i = 0; i < 1 << n; i++)
    for (j = 0; j <= n * n; j++)
      if (f[i][j] != -1) ans = min(ans, max(sr - j, sb - f[i][j]) + n);
  printf("%d\n", ans);
  return 0;
}
