#include <bits/stdc++.h>
using namespace std;
const int N = 16, M = 1 << N, K = N * N / 2;
int c[N], r[N], b[N];
int n, tr, tb;
int f[M][K], cr[M], cb[M];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    char ch;
    scanf(" %c %d%d", &ch, r + i, b + i);
    c[i] = ch == 'R';
    tr += r[i];
    tb += b[i];
  }
  for (int i = 0; i < (1 << n); ++i) {
    for (int j = 0; j < n; ++j) {
      if (i >> j & 1) {
        cr[i] += c[j];
        cb[i] += 1 - c[j];
      }
    }
  }
  memset(f, -1, sizeof(f));
  f[0][0] = 0;
  for (int i = 0; i < (1 << n); ++i) {
    for (int k = 0; k < K; ++k)
      if (f[i][k] >= 0) {
        for (int j = 0; j < n; ++j)
          if (~i >> j & 1) {
            int ii = i | 1 << j;
            int kk = f[i][k];
            int sr = min(r[j], cr[i]);
            int sb = min(b[j], cb[i]);
            f[ii][k + sr] = max(f[ii][k + sr], kk + sb);
          }
      }
  }
  int i = 1 << n;
  int ans = max(tr, tb);
  --i;
  for (int k = 0; k < K; ++k) {
    int kk = f[i][k];
    if (kk >= 0) {
      ans = min(ans, max(tr - k, tb - kk));
    }
  }
  printf("%d\n", n + ans);
  return 0;
}
