#include <bits/stdc++.h>
using namespace std;
int r[16], b[16];
char c[16];
int dp[1 << 16][200];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> c[i] >> r[i] >> b[i];
  memset(dp, -1, sizeof dp);
  int max_save = n * (n + 1) / 2;
  dp[0][0] = 0;
  for (int msk = 0; msk < (1 << n); msk++) {
    for (int save_a = 0; save_a <= max_save; save_a++) {
      if (dp[msk][save_a] == -1) continue;
      int A = 0, B = 0;
      for (int t = 0; t < n; t++) {
        if (msk & (1 << t)) {
          if (c[t] == 'R')
            A++;
          else
            B++;
        }
      }
      for (int buy = 0; buy < n; buy++) {
        if (msk & (1 << buy)) continue;
        int a_next = save_a + min(r[buy], A);
        int b_next = dp[msk][save_a] + min(b[buy], B);
        dp[msk | (1 << buy)][a_next] =
            max(dp[msk | (1 << buy)][a_next], b_next);
      }
    }
  }
  int sum_r = 0, sum_b = 0;
  for (int i = 0; i < n; i++) {
    sum_r += r[i];
    sum_b += b[i];
  }
  int ans = max(sum_r, sum_b);
  for (int save_a = 0; save_a <= max_save; save_a++) {
    int save_b = dp[(1 << n) - 1][save_a];
    if (save_b == -1) continue;
    int tmp = max(sum_r - save_a, sum_b - save_b);
    ans = min(ans, tmp);
  }
  cout << ans + n;
}
