#include <bits/stdc++.h>
using namespace std;
int ans, n, i, hh, j, ii, now, mx, mxr, a[21][3], sum0, sum1, f[1 << 17][121],
    g[1 << 17][2];
char s[11];
int main() {
  scanf("%d", &n);
  for (i = 1; i < n; i++) mxr += i;
  for (i = 0; i < n; i++) {
    scanf("%s %d %d", s, &a[i][0], &a[i][1]);
    sum0 += a[i][0];
    sum1 += a[i][1];
    a[i][2] = s[0] == 'R' ? 0 : 1;
  }
  mx = (1 << n) - 1;
  for (i = 0; i <= mx; i++) {
    now = i;
    hh = -1;
    while (now) {
      hh++;
      if (now % 2 == 1) {
        g[i][a[hh][2]]++;
      }
      now /= 2;
    }
  }
  memset(f, -1, sizeof(f));
  f[0][0] = 0;
  for (i = 0; i < mx; i++)
    for (ii = 0; ii <= mxr; ii++)
      if (f[i][ii] != -1) {
        for (j = 0; j < n; j++)
          if (!(i & (1 << j))) {
            now = i | (1 << j);
            f[now][ii + min(a[j][0], g[i][0])] =
                max(f[now][ii + min(a[j][0], g[i][0])],
                    f[i][ii] + min(g[i][1], a[j][1]));
          }
      }
  ans = 1e9;
  for (i = 0; i <= mxr; i++) {
    if (f[mx][i] >= 0) ans = min(ans, max(sum0 - i, sum1 - f[mx][i]));
  }
  printf("%d", ans + n);
}
