#include <bits/stdc++.h>
using namespace std;
int n, m;
int A[20], B[20], Is[20];
char st[10];
int dp[1 << 16][150];
void Work() {
  memset(dp, -1, sizeof(dp));
  dp[0][0] = 0;
  for (int sta = 0; sta < (1 << n); sta++)
    for (int i = 0; i <= m; i++)
      if (dp[sta][i] != -1) {
        int nA = 0, nB = 0;
        for (int j = 1; j <= n; j++)
          if (sta & (1 << j - 1))
            if (Is[j])
              nA++;
            else
              nB++;
        for (int j = 1; j <= n; j++)
          if ((sta & (1 << j - 1)) == 0) {
            int sA = min(nA, A[j]), sB = min(nB, B[j]);
            dp[sta ^ (1 << j - 1)][i + sA] =
                max(dp[sta ^ (1 << j - 1)][i + sA], dp[sta][i] + sB);
          }
      }
  int totA = 0, totB = 0;
  for (int i = 1; i <= n; i++) totA += A[i], totB += B[i];
  int ans = 0x7f7f7f7f;
  for (int i = 0; i <= m; i++)
    if (dp[(1 << n) - 1][i] != -1) {
      ans = min(ans, max(totA - i, totB - dp[(1 << n) - 1][i]));
    }
  printf("%d\n", ans + n);
}
void Init() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x, y;
    scanf("%s%d%d", st, &A[i], &B[i]);
    Is[i] = st[0] == 'R';
  }
  for (int i = 0; i < n; i++) m += i;
}
int main() {
  Init();
  Work();
  return 0;
}
