#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, k,
    dp[1 << 17][1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 +
                15 + 16 + 17],
    sr[1 << 17], sb[1 << 17], r[17], b[17], cr, cb, ans = 1 << 31 - 1;
char op[17];
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> op[i] >> r[i] >> b[i];
  }
  for (i = 0; i < (1 << n); i++) {
    for (j = 0; j < n; j++) {
      if ((1 << j) & i) (sr[i] += (op[j] == 'R')), (sb[i] += (op[j] == 'B'));
    }
  }
  for (i = 0; i < (1 << n); i++) {
    for (j = 0; j <= 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 +
                         14 + 15 + 16 + 17;
         j++) {
      dp[i][j] = -1e9;
    }
  }
  dp[0][0] = 0;
  for (i = 0; i < (1 << n); i++) {
    for (k = 0; k < n; k++) {
      if (((1 << k) & i)) continue;
      int msk = (1 << k) | i;
      int nr = min(r[k], sr[i]), nb = min(b[k], sb[i]);
      for (j = 0; j <= 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 +
                           14 + 15 + 16;
           j++) {
        dp[msk][j + nr] = max(dp[msk][j + nr], dp[i][j] + nb);
      }
    }
  }
  for (i = 0; i < n; i++) cr += r[i], cb += b[i];
  for (i = 0; i <= 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 +
                       15 + 16 + 10;
       i++) {
    ans = min(ans, max(cr - i, cb - dp[(1 << n) - 1][i]));
  }
  cout << ans + n;
  return 0;
}
