#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const double pi = acos(-1.0);
const int K = 1e6 + 7;
const int mod = 1e9 + 7;
int n, sz, sumr, sumb, r[20], b[20], dp[1 << 16][150], sred[20], sblue[20];
char col[20];
int main() {
  cin >> n;
  sz = 1 << n;
  for (int i = 0; i < n; i++)
    scanf("%s%d%d", col + i, r + i, b + i), sumr += r[i], sumb += b[i];
  memset(dp, 0xef, sizeof(dp));
  dp[0][0] = 0;
  for (int i = 0; i < sz; i++) {
    int sr, sb;
    sr = sb = 0;
    for (int j = 0; j < n; j++)
      if (i & (1 << j)) {
        col[j] == 'R' ? sr++ : sb++;
      }
    for (int j = 0; j < n; j++) {
      if (!(i & (1 << j))) {
        sred[j] = min(sr, r[j]);
        sblue[j] = min(sb, b[j]);
      }
    }
    for (int j = 0; j < n; j++) {
      if (!(i & (1 << j))) {
        for (int k = 0; k <= 120; k++) {
          dp[i | (1 << j)][k + sred[j]] =
              max(dp[i | (1 << j)][k + sred[j]], dp[i][k] + sblue[j]);
        }
      }
    }
  }
  int ans = 0x3f3f3f3f;
  for (int i = 0; i <= 120; i++)
    ans = min(max(sumr - i, sumb - dp[sz - 1][i]), ans);
  printf("%d\n", ans + n);
  return 0;
}
