#include <bits/stdc++.h>
using namespace std;
char op[16][2];
int n, s, dp[1 << 16][121], ta[16], tb[16], ra[1 << 16], rb[1 << 16];
int resta, restb;
int main() {
  scanf("%d", &n);
  s = 1 << n;
  for (int i = 0; i < n; i++) {
    scanf("%s%d%d", op[i], &ta[i], &tb[i]);
    resta += ta[i];
    restb += tb[i];
  }
  for (int i = 0; i < s; i++)
    for (int j = 0; j < n; j++) {
      if (i & (1 << j)) {
        if (op[j][0] == 'R')
          ra[i]++;
        else
          rb[i]++;
      }
    }
  memset(dp, -1, sizeof(dp));
  dp[0][0] = 0;
  for (int i = 0; i < s; i++)
    for (int j = 0; j <= 120; j++) {
      if (dp[i][j] == -1) continue;
      for (int k = 0; k < n; k++) {
        if (i & (1 << k)) continue;
        int na = min(ta[k], ra[i]);
        int nb = min(tb[k], rb[i]);
        dp[i | (1 << k)][j + na] = max(dp[i | (1 << k)][j + na], dp[i][j] + nb);
      }
    }
  int res = max(resta, restb);
  for (int i = 0; i < 120; i++) {
    if (dp[s - 1][i] != -1)
      res = min(res, max(resta - i, restb - dp[s - 1][i]));
  }
  printf("%d\n", res + n);
  return 0;
}
