#include <bits/stdc++.h>
using namespace std;
const int maxn = 1 << 16;
int n, rr, bb, c[20], b[20], ed, r[20], tr[maxn], tb[maxn], dp[maxn][400],
    ans = 0x3f3f3f3f;
int main() {
  cin >> n;
  getchar();
  for (int i = 1; i <= n; i++) {
    char ch;
    cin >> ch >> r[i] >> b[i];
    if (ch == 'R') c[i] = 1;
    rr += r[i];
    bb += b[i];
  }
  ed = (1 << n) - 1;
  for (int i = 0; i <= ed; i++) {
    for (int j = 0; j < n; j++)
      if (i & (1 << j)) {
        if (c[j + 1])
          tr[i]++;
        else
          tb[i]++;
      }
  }
  memset(dp, -1, sizeof(dp));
  dp[0][0] = 0;
  for (int i = 0; i <= ed; i++)
    for (int j = 0; j <= n * n; j++) {
      if (dp[i][j] == -1) continue;
      for (int k = 0; k < n; k++) {
        if (i & (1 << k)) continue;
        int next = i | (1 << k);
        int na = min(tr[i], r[k + 1]), nb = min(tb[i], b[k + 1]);
        dp[next][j + na] = max(dp[next][j + na], dp[i][j] + nb);
      }
    }
  ans = max(rr, bb);
  for (int i = 0; i <= n * n; i++) {
    if (dp[ed][i] == -1) continue;
    ans = min(ans, max(rr - i, bb - dp[ed][i]));
  }
  cout << ans + n << endl;
  return 0;
}
